question

newuser-e664859f-4f70-40a9-a2ec-6f32b6535e85 avatar image

Amazon app crashes on Fire HD 10 (2019) on receive push notification (IllegalStateException: Not allowed to start service Intent)

It is absolutely clear why it happens: Fire OS 7(android 8) forbids to start IntentService when app is in background. We should use JobIntentService instead of IntentService, but Amazon doesn't provide any steps to migrate current ADM implementation for proper using at new version of Fire OS.


Amazon Device Messaging integrate docs: https://developer.amazon.com/docs/adm/integrate-your-app.html


java.lang.IllegalStateException: Not allowed to start service Intent


java.lang.IllegalStateException: Not allowed to start service Intent { act=com.amazon.device.messaging.intent.REGISTRATION cat=[com.app.my] flg=0x10 pkg=com.app.my cmp=com.app.my/com.app.my.PlayrixAdmService (has extras) }: app is in background uid UidRecord{d2fb1b1 u0a179 RCVR idle change:uncached procs:1 seq(0,0,0)}


Stack:

  • android.app.ContextImpl.startServiceCommon ContextImpl.java:1613
  • android.app.ContextImpl.startService ContextImpl.java:1568
  • android.content.ContextWrapper.startService ContextWrapper.java:664
  • android.content.ContextWrapper.startService ContextWrapper.java:664
  • com.amazon.device.messaging.ADMMessageReceiver.onReceive ADMMessageReceiver.java:118
  • android.app.ActivityThread.handleReceiver ActivityThread.java:3400
  • android.app.ActivityThread.access$1200 ActivityThread.java:207
  • android.app.ActivityThread$H.handleMessage ActivityThread.java:1671
  • android.os.Handler.dispatchMessage Handler.java:106
  • android.os.Looper.loop Looper.java:193
  • android.app.ActivityThread.main ActivityThread.java:6734
  • java.lang.reflect.Method.invoke Method.java
  • com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493
  • com.android.internal.os.ZygoteInit.main ZygoteInit.java:893
amazon device messagingjava
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kasten avatar image
Kasten answered

This seems like a bug with FireOS itself. Since we are seeing "com.amazon.device.messaging.ADMMessageReceiver.onReceive ADMMessageReceiver.java:118 " as the last non-Android method in the stack. It seems like FireOS hasn't updated to using a JobScheduler for ADM since switching to Android 9 as a base.

For reference there another thread open with this same crash

https://forums.developer.amazon.com/questions/217627/crash-in-admmessagereceiver-on-fire-os-7.html


Also for reference there is a Github issue open about it in the OneSignal repo
https://github.com/OneSignal/OneSignal-Android-SDK/issues/890

10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-e664859f-4f70-40a9-a2ec-6f32b6535e85 avatar image
newuser-e664859f-4f70-40a9-a2ec-6f32b6535e85 answered
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.