/DeviceMarketingNames

Marketing device name lookup library for Android.

Primary LanguageKotlinApache License 2.0Apache-2.0

Maven Central Version codecov GitHub Workflow Status GitHub

Device Marketing Names

A simple device name lookup package. Map e.g. 'SM-G980F' to 'Galaxy S20'. No internet connection or database required.

Features

  • Lookup Android marketing names
  • Get the marketing name(s) of the current device or by an already known Android model
  • Uses the Build.MODEL information and device_identifiers which maps those to the marketing names.

Usage

Getting Started

Add this to your app build.gradle file:

dependencies {
    ...
    implementation 'de.boehrsi:devicemarketingnames:0.4.8'
}

Migration 0.3.x to 0.4.0

Versions prior to 0.4.0 where available via Jitpack with the package name com.github.Boehrsi:DeviceMarketingNames.
Starting with version 0.4.0 new versions are deployed via Maven Central with the new package name de.boehrsi:devicemarketingnames.

To migrate please adjust your current build.gradle entry from

dependencies {
  ...
  implementation 'com.github.Boehrsi:DeviceMarketingNames:0.3.x'
}

to the new package

dependencies {
  ... 
  implementation 'de.boehrsi:devicemarketingnames:0.4.0'
}

The additional repository definition in your root build.gradle file can be removed.

Examples

For full examples please see the example app.

// Get one marketing name of the device.
val deviceName = DeviceMarketingNames.getSingleName()

// Get all marketing names of the device.
val deviceNames = DeviceMarketingNames.getNames()

// Get one marketing name for the given model.
val deviceNameFromModel = DeviceMarketingNames.getSingleNameFromModel("ONEPLUS A5010")

// Get all marketing names for the given model.
val deviceNamesFromModel = DeviceMarketingNames.getNamesFromModel("ONEPLUS A5010");

How to contribute

If you are interested in contributing, please have a look into the contribution guide. Every idea, bug report or line of code is heavily appreciated.