Skip to content

Replace DeviceNames library

Albert Vaca Cintora requested to merge work/replace-device-name into master

The DeviceNames library was used to convert the internal Android device name to a human-friendly device name (aka marketing name). Eg: SM-A125F -> Samsung Galaxy A12.

The version 1.x of the library we were using stopped working in 2020 when the names database it tries to download got deleted from the master branch of their Github repo.

There's a newer version, but looking at the code it seems to have lost the fetch-from-the-internet functionality (it only bundles a list of names) and for some reason it crashes when I tested it (I've opened an issue on their repo).

Since Google now provides a CSV with all the Android device names that exist, I've replaced the library by my own function that downloads the CSV file (~3MB) in the first run of the app and looks for the name there.

Drawbacks

The database that the library used to download was a bit more compact (~1.5MB) and likely faster to query than a CSV, but I think it's okay for something that runs a single time.

The library contained a built-in list of the 600 most common devices (as of late 2019) for which it didn't have to download anything. With this implementation every device will always download the ~3MB file once.

Edited by Albert Vaca Cintora

Merge request reports