{"id":15297030,"url":"https://github.com/tslamic/androiddevicenames","last_synced_at":"2025-08-22T00:31:56.319Z","repository":{"id":36281295,"uuid":"40585798","full_name":"tslamic/AndroidDeviceNames","owner":"tslamic","description":"A tiny Android library that transforms the device model name into something users can understand.","archived":false,"fork":false,"pushed_at":"2017-09-17T16:24:36.000Z","size":1688,"stargazers_count":191,"open_issues_count":0,"forks_count":23,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-12-20T06:06:56.448Z","etag":null,"topics":["android","devices","library","names","offline"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tslamic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-12T07:11:14.000Z","updated_at":"2024-12-13T21:20:48.000Z","dependencies_parsed_at":"2022-09-04T14:22:20.970Z","dependency_job_id":null,"html_url":"https://github.com/tslamic/AndroidDeviceNames","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tslamic%2FAndroidDeviceNames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tslamic%2FAndroidDeviceNames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tslamic%2FAndroidDeviceNames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tslamic%2FAndroidDeviceNames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tslamic","download_url":"https://codeload.github.com/tslamic/AndroidDeviceNames/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230542288,"owners_count":18242332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","devices","library","names","offline"],"created_at":"2024-09-30T19:14:39.214Z","updated_at":"2024-12-20T06:06:59.143Z","avatar_url":"https://github.com/tslamic.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Android Device Names [![Build Status](https://travis-ci.org/tslamic/AndroidDeviceNames.svg?branch=master)](https://travis-ci.org/tslamic/AndroidDeviceNames)\n===\n\nThis tiny Android library transforms a device model name into something people can understand. For example, a useless `SM-N910W8` becomes `Samsung Galaxy Note4` with a single method call. :tada: It currently recognizes about 15k devices, including all [Google Play supported devices](https://support.google.com/googleplay/answer/1727131).\n\n**It does not require network connectivity, ever. No, really.** \n\nTo use it, add the following to your list of dependencies:\n\n```groovy\ncompile 'com.github.tslamic:dn3:3.0'\n```\n\nThere are two classes you can use:\n\n 1. `DeviceNames` use this if all you need is a *single* query.\n 2. `DeviceNamesDatabase` for multiple queries. Don't forget to close it afterwards!\n\nRxJava2 is supported out of the box. Obtaining a `DeviceNames` instance is easy:\n\n```java\nAndroidDeviceNames.deviceNames(context)\n  .subscribeOn(Schedulers.io())\n  .observeOn(AndroidSchedulers.mainThread())\n  .subscribe(names -\u003e doSomethingWith(names));\n```\n\nbut good ol' callbacks are supported too, in case you don't feel reactive:\n\n```java\nAndroidDeviceNames.deviceNames(context,\n  new AndroidDeviceNames.Callback\u003cDeviceNames\u003e() {\n    @Override \n    public void onReady(@NonNull DeviceNames instance) {\n      String name = instance.currentDeviceName(); \n    }\n  });\n```\n\nYou can obtain an instance of `DeviceNamesDatabase` in a similar fashion. After you're done using it, don't forget to explicitly call `close()`. For example:\n \n```java\n@Override\nprotected void onStart() {\n  super.onStart();\n  AndroidDeviceNames.deviceNamesDatabase(this,\n    new AndroidDeviceNames.Callback\u003cDeviceNamesDatabase\u003e() {\n      @Override\n      public void onReady(@NonNull DeviceNamesDatabase instance) {\n        database = instance;\n      }\n    });\n}\n\n@Override\nprotected void onStop() {\n  super.onStop();\n  if (database != null) {\n    database.close();\n  }\n}\n```\n\nBoth `DeviceNames` and `DeviceNamesDatabase` come with three methods:\n\n| method | description |\n| -----: | :---------- |\n| `currentDeviceName()` |  Returns a user-friendly current device name, or `null` if the model is unknown. |\n| `currentDeviceName(String fallback)`| Same as above, but returns `fallback` if the model is unknown. |\n| `deviceName(String model, String fallback)` | Returns a user-friendly name for the specified `model`, or `fallback`, if model is unknown. |\n\n### Not backwards compatible with v1 or v2, sorry.\n\nIf you've been using AndroidDeviceNames v1 or v2, please note that this version is not backwards compatible. \nUpdating should be trivial, result in minimal code change and is highly encouraged.\n\n### Contributions\n\nSpecial thanks to [@corcoran](https://github.com/corcoran) for making numerous improvements to the lib.\n\n### In the wild\n\nHere's the list of apps using this lib:\n\n- [XDA Labs](https://www.xda-developers.com/xda-labs)\n\nIf you're using it in your app, and want to be on the above list, please let me know (create a pull request or open an issue).\n\nLicense\n---\n\n    Copyright 2017 Tadej Slamic\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftslamic%2Fandroiddevicenames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftslamic%2Fandroiddevicenames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftslamic%2Fandroiddevicenames/lists"}