2

I have implemented GcmIntentService for push notification everything was working fine but when updated version to Android 8 (Oreo) it is getting crash on oreo devices. Is it possible that I can continue uses of GcmIntentService for push notification.

Please share your view thanks in advance

Getting exception

java.lang.RuntimeException: Unable to start receiver com.example.PushNotificationReceiver: 
java.lang.IllegalStateException: Not allowed to start service Intent {
act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.example
cmp=com.example/.pushnotification.GCMIntentService (has extras) }: 
app is in background uid UidRecord{635678a u0a186 RCVR bg:+1m44s591ms idle
procs:1 seq(0,0,0)}
Zoe
  • 27,060
  • 21
  • 118
  • 148
hharry_tech
  • 952
  • 1
  • 8
  • 24

1 Answers1

0

Google already announced GCMs deprecation. Please proceed in migrating to FCM.

AL is right, but GCM will only truly no longer work on April 11, 2019 as is stated here.

I believe the issue you faced is not related to this but rather, the fact that you are attempting to start a background service from your receiver class. Starting from Android 8, applications can no longer start background service when the application is not visible in the foreground.

Reference: https://developer.android.com/about/versions/oreo/android-8.0-changes#back-all

avelyne
  • 710
  • 6
  • 15