react-native-notifications icon indicating copy to clipboard operation
react-native-notifications copied to clipboard

startService issue on Oreo

Open m-makuch opened this issue 8 years ago • 3 comments

GcmInstanceIdListenerService and RNNotificationsModule use startService method, but according to this it has to be replaced with startForegroundService and startForeground

After upgrading target SDK I have started getting crashes after notification is received if app is in background or closed state.

Any ideas for solution for this?

Error:

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.google.android.gms.gcm.GcmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.package cmp=com.package/com.wix.reactnativenotifications.gcm.GcmMessageHandlerService (has extras) }: app is in background uid UidRecord{0000000 00000 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3194)
       at android.app.ActivityThread.-wrap17(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

m-makuch avatar Aug 22 '18 14:08 m-makuch

I tried replacing startService with mentioned methods, but that didn't solve it. However upgrading com.google.android.gms:play-services-gcm from 10.0.2 to 11.2.2 in my app's app/build.gradle did solve the issue.

m-makuch avatar Aug 23 '18 09:08 m-makuch

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Jul 24 '19 20:07 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Jul 31 '19 21:07 stale[bot]