android-model-names
Version:
Convert Android device strings to human-readable manufacturer and model names
52 lines (30 loc) • 1.83 kB
Markdown
A tiny helper library to convert Android hardware strings ("GT-I9060") into human-readable model names ("Galaxy Grand Neo").
Supports all devices that are compatible with Google Play. See [Translation Sources](#translation-sources) for more info.
## Usage
First, install the library:
```
npm install --save android-model-names
```
Then, import and use:
```
import getModelName from 'android-model-names';
getModelName('GT-I9060'); // 'Galaxy Grand Neo'
getModelName('GT-I9060', { full: true }); // { manufacturer: 'Samsung', model: 'Galaxy Grand Neo', key: 'GT-I9060' }
// Examples with no matching result
getModelName('GT-I9999'); // 'GT-I9999'
getModelName('GT-I9999', { full: true }); // { key: 'GT-I9060' }
```
An options hash can be passed in as a second parameter to customize the return data. Here are the available options:
Option | Default Value | Description
------ | ------------- | -----------
`full` | `false` | Return an object with manufacturer, marketing name (model), and original string key.
## Translation Sources
The translations are pulled straight from Google's support page on supported Google Play devices, which is an exhaustive enough list for this purpose.
[View the full device list here in CSV format](http://storage.googleapis.com/play_public/supported_devices.csv).
## Missing a model? Found a bug?
We welcome contributions! Feel free to [open an issue](https://github.com/twitter-fabric/android-model-names/issues/new) (or a PR!) if you notice any missing models (new releases, etc.), or spot a bug. Thanks!
## License
Copyright 2016 Twitter, Inc.
Licensed under the MIT License: https://opensource.org/licenses/MIT