AndroidDeviceNames icon indicating copy to clipboard operation
AndroidDeviceNames copied to clipboard

No value for manufacturer

Open prechtelm opened this issue 5 years ago • 7 comments

Hi, we upgraded to 2.0.0. Following exception is thrown:

org.json.JSONException: No value for manufacturer
     at org.json.JSONObject.get(JSONObject.java:399)
     at org.json.JSONObject.getString(JSONObject.java:560)
     at com.jaredrummler.android.device.DeviceName$DeviceInfo.<init>(DeviceName.java:374)
     at com.jaredrummler.android.device.DeviceName$DeviceInfo.<init>(DeviceName.java:347)
     at com.jaredrummler.android.device.DeviceName.getDeviceInfo(DeviceName.java:186)
     at com.jaredrummler.android.device.DeviceName.getDeviceName(DeviceName.java:138)

prechtelm avatar Mar 31 '20 10:03 prechtelm

Just upgraded to 2.0.0 and found that manufacturer is marked deprecated. Looked around in the code for any mention but did not find any yet. The hint is that we are not supposed to use it but then what are we supposed to use instead?

jeffreymuir avatar May 26 '20 01:05 jeffreymuir

Found that it could have a null manufacturer with Google Pixel 3a. Looking at the code, it might be related to SharedPrefs from previous version. It caches using the shared preferences and might have an old entry. Noticed that it is saving the manufacturer when it looks it up in the database. Worked around it by using the Build.MANUFACTURER from Android.

jeffreymuir avatar May 28 '20 01:05 jeffreymuir

Kind of a blocker now. This library isn't usable currently

Climax777 avatar Jul 01 '20 20:07 Climax777

I am getting this crash on a Moto G4 Plus with the 2.0.0 version. I noticed it is just a warning log. At the end it is returning a proper value to DeviceName.getDeviceName(). I am getting "Moto G (5) Plus" which is fair enough (but my device is 4, not 5)

arlm1 avatar Jul 03 '20 02:07 arlm1

Same Error here with a Google Pixel 2

ChrAnd2 avatar Jul 08 '20 10:07 ChrAnd2

Same here on a Lenovo TB-8304F1

digitaldjango avatar Jul 09 '20 09:07 digitaldjango

'manufacturer' is deprecated Untitled manufacturer = info.manufacturer is null

shahramomidvar avatar Dec 10 '20 13:12 shahramomidvar