treehouses / remote

⚡ control Raspberry Pi from Android Device through Bluetooth ⚡
https://play.google.com/store/apps/details?id=io.treehouses.remote
GNU Affero General Public License v3.0
64 stars 29 forks source link

null pointer Android ID #756

Closed sriharivishnu closed 4 years ago

sriharivishnu commented 4 years ago

From Play Console:

java.lang.NullPointerException: 
  at io.treehouses.remote.utils.Utils.getAndroidId (Utils.java:40)
  at io.treehouses.remote.Network.ParseDbService.sendLog (ParseDbService.java:28)
  at io.treehouses.remote.bases.BaseHomeFragment.sendLog (BaseHomeFragment.java:108)
  at io.treehouses.remote.bases.BaseHomeFragment.checkImageInfo (BaseHomeFragment.java:94)
  at io.treehouses.remote.Fragments.HomeFragment.readMessage (HomeFragment.java:301)
  at io.treehouses.remote.Fragments.HomeFragment.access$500 (HomeFragment.java:53)
  at io.treehouses.remote.Fragments.HomeFragment$4.handleMessage (HomeFragment.java:348)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:198)
  at android.app.ActivityThread.main (ActivityThread.java:7055)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:523)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:836)
sriharivishnu commented 4 years ago

From https://developer.android.com/training/articles/user-data-ids#java,

Avoid using hardware identifiers. In most use cases, you can avoid using hardware identifiers, such as SSAID (Android ID), without limiting required functionality.

Android 10 (API level 29) adds restrictions for non-resettable identifiers, which include both IMEI and serial number. Your app must be a device or profile owner app, have special carrier permissions, or have the READ_PRIVILEGED_PHONE_STATE privileged permission in order to access these identifiers.