Android Question Security exception on Samsung 5.0 Devices (READ_PHONE_STATE) while starting service

corwin42

Expert
Licensed User
I recently get the following errors in the PlayStore console:

java.lang.RuntimeException: Unable to start service de.amberhome.weather2free.weatherupdater@325a6d27 with Intent { cmp=de.amberhome.weather2free/.weatherupdater }: java.lang.RuntimeException: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10271 nor current process has android.permission.READ_PHONE_STATE.
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326)
at android.app.ActivityThread.access$2200(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1547)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5944)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.RuntimeException: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10271 nor current process has android.permission.READ_PHONE_STATE.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at de.amberhome.weather2free.weatherupdater.handleStart(weatherupdater.java:71)
at de.amberhome.weather2free.weatherupdater.onStartCommand(weatherupdater.java:55)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3309)
... 9 more
Caused by: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10271 nor current process has android.permission.READ_PHONE_STATE.
at android.os.Parcel.readException(Parcel.java:1540)
at android.os.Parcel.readException(Parcel.java:1493)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getDataState(ITelephony.java:2753)
at android.telephony.TelephonyManager.getDataState(TelephonyManager.java:2348)
at anywheresoftware.b4a.phone.Phone.GetDataState(Phone.java:313)
at de.amberhome.weather2free.util._vvvvvvvvvvv5(util.java:100)
at de.amberhome.weather2free.weatherupdater._service_start(weatherupdater.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
... 13 more
This seems to happen when the service gets started in the background which handles weather data updates. The strange thing is:
This happens ONLY on Samsung devices with Android 5.0.

I searched for this problem but didn't find anything about it.

Somebody here have the same errors? Unfortunately I don't have a Samsung device but I will just add the permission to the manifest and hopefully this error will go away.
 
Top