OneSignal / OneSignal-Unity-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Other
222 stars 61 forks source link

On Amazon device OneSignal messages stop showing after the device is restarted or randomly a couple of minutes after the app is closed #417

Open GinsGins opened 2 years ago

GinsGins commented 2 years ago

Description:

Environment

  1. I am using 2.13.6 version of oneSignal unity SDK
  2. This issue occurs only in Amazon Fire OS (I am testing on Fire HD 8 Plus - 10th generation - Fire OS 7.3.2.2)

Steps to Reproduce Issue:

  1. Import one signal unity sdk 2.13.6
  2. Set up one signal for Amazon devices
  3. Open App (Device registers and one signal messages work)
  4. Restart device
  5. Don't open the app
  6. Try sending push notification to the device
  7. That is when the error occurs

Anything else: Error Message: 12-03 09:20:57.971 +0000 576 1137 W ActivityManager: Background start not allowed: service Intent { act=com.amazon.device.messaging.intent.RECEIVE cat=[com.DefaultCompany.AppName] flg=0x10 pkg=com.DefaultCompany.AppName cmp=com.DefaultCompany.AppName/com.onesignal.ADMMessageHandler (has extras) } to com.DefaultCompany.AppName/com.onesignal.ADMMessageHandler from pid=14235 uid=10188 pkg=com.DefaultCompany.AppName startFg?=false 12-03 09:20:57.974 +0000 14235 14235 D AndroidRuntime: Shutting down VM 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: FATAL EXCEPTION: main 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: Process: com.DefaultCompany.AppName, PID: 14235 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.onesignal.ADMMessageHandler$Receiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.amazon.device.messaging.intent.RECEIVE cat=[com.DefaultCompany.AppName] flg=0x10 pkg=com.DefaultCompany.AppName cmp=com.DefaultCompany.AppName/com.onesignal.ADMMessageHandler (has extras) }: app is in background uid UidRecord{4b00121 u0a188 RCVR idle change:uncached procs:1 seq(0,0,0)} 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3415) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ActivityThread.access$1200(ActivityThread.java:207) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1670) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6740) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.amazon.device.messaging.intent.RECEIVE cat=[com.DefaultCompany.AppName] flg=0x10 pkg=com.DefaultCompany.AppName cmp=com.DefaultCompany.AppName/com.onesignal.ADMMessageHandler (has extras) }: app is in background uid UidRecord{4b00121 u0a188 RCVR idle change:uncached procs:1 seq(0,0,0)} 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1613) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1568) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at com.amazon.device.messaging.ADMMessageReceiver.onReceive(ADMMessageReceiver.java:118) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3406) 12-03 09:20:57.975 +0000 14235 14235 E AndroidRuntime: ... 8 more

My investigation: I found this similar issue in your android sdk: https://github.com/OneSignal/OneSignal-Android-SDK/issues/890 which was fixed for your android sdk with this commit (commit that added support for FireOS 7): https://github.com/OneSignal/OneSignal-Android-SDK/pull/1184 which if i understand implements the adm message handler job base, In the unity sdk i didn't see those changes, could that be the case, that support for fire OS 7 was not yet added in your unity SDK?

gadzilka commented 2 years ago

We see the same crashes in our Firebase Crashlytics in Google Play build on Fire HD 8, Fire HD 8 Plus, Fire HD 10 (2019, 2021). OneSignal SDK: 3.0.2 Unity: 2020.3.36f1

jkasten2 commented 4 months ago

@GinsGins The OneSignal SDK wasn't compatible with FireOS 7 until OneSignal-Unity-SDK 3.0.0.

@gadzilka Do you see this issue still if you update to the latest OneSignal-Unity-SDK 3.x.x SDK or 5.x.x SDK? if you do let us know what logcat entries you get, such as what was posted above.