Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

OneSignal with targetSdkVersion=26 getting error Background start not allowed: service Intent { cmp=***/com.onesignal.GcmIntentService(has extras) }
Started by p.kanarek Jun 12 2018 07:56 AM

10 replies to this topic
onesignal gcmintentservice targetsdkversion push

Best Answer Rob Miracle , 12 June 2018 - 01:00 PM

OneSignal maintains their own plugin. It will be up to them to update it after we enable SDK version 26.

 

Rob

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 12 posts
  • Corona SDK

Hello everyone. 

I stared to preparing my app to newest Google Play's target API level requirement , that says:

 

Google Play will require that new apps target at least Android 8.0 (API level 26) from August 1, 2018, and that app updates target Android 8.0 from November 1, 2018.

 

 

But unfortunately, when i changed value of android:targetSdkVersion to "26" in my manifest.xml file i cannot recieve any push notifications when my app is closed/running on background.

 

When app is active everything works perfectly (alert is showing with correct data) so i know that notifications works in some limited way but they are delivered correctly. In conclusion this is not problem with OneSignal portal, but with OneSignal Plugin. 

 

Main problem is when app is closed - when notification is delivered nothing happens, there is no sound/vibrate/notification. I got logcat from device (Huawei Mate 10 pro, Android 8.0) generated at time of push delivery: 

06-12 15:10:36.895  1195  1823 W ActivityManager: Background start not allowed: service Intent { cmp=my_package_name/com.onesignal.GcmIntentService (has extras) } to my_package_name/com.onesignal.GcmIntentService from pid=7731 uid=10432 pkg=my_package_name
06-12 15:10:36.896  7731  7731 D AndroidRuntime: Shutting down VM
--------- beginning of crash
06-12 15:10:36.897  7731  7731 E AndroidRuntime: FATAL EXCEPTION: main
06-12 15:10:36.897  7731  7731 E AndroidRuntime: Process: my_package_name, PID: 7731
06-12 15:10:36.897  7731  7731 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.onesignal.GcmBroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=my_package_name/com.onesignal.GcmIntentService (has extras) }: app is in background uid UidRecord{6197f04 u0a432 RCVR idle procs:1 seq(0,0,0)}
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:3705)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ActivityThread.-wrap18(Unknown Source:0)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1979)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:108)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:166)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7425)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=my_package_name/com.onesignal.GcmIntentService (has extras) }: app is in background uid UidRecord{6197f04 u0a432 RCVR idle procs:1 seq(0,0,0)}
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1701)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ContextImpl.startService(ContextImpl.java:1657)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.content.ContextWrapper.startService(ContextWrapper.java:644)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.content.ContextWrapper.startService(ContextWrapper.java:644)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(SourceFile:91)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at com.onesignal.GcmBroadcastReceiver.processOrderBroadcast(SourceFile:76)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at com.onesignal.GcmBroadcastReceiver.onReceive(SourceFile:59)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:3695)
06-12 15:10:36.897  7731  7731 E AndroidRuntime: 	... 8 more
06-12 15:10:36.897  1195  1823 V BroadcastQueue: Finished with ordered broadcast BroadcastRecord{c72b8ca u0 com.google.android.c2dm.intent.RECEIVE}
06-12 15:10:36.898  3082  3082 W GCM     : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=my_package_name (has extras) }
06-12 15:10:36.900  1195  1823 I ActivityManager: Killing 30060:com.instagram.android/u0a109 (adj 906): empty #33
06-12 15:10:36.909  1195  3422 E ReportTools: This is not beta user build

What i can do? I've downloaded latest OneSignal Plugin...

 

Moreover when android:targetSdkVersion is set to  "25" everything works perfectly, but this solution is only temporary.

 

Whats more I've build my app using Corona Simulator then decoded output app with apktool and i found that the latest daily version of Corona (2018.3315) is still using android:targetSdkVersion="25". 

 

Last thing: I've tested app that was build with parameter android:targetSdkVersion set to "26" on device with Android 7.0 (Samsung s6) and with my surprise, notifications works correctly when app is closed. So problem is only with Android 8.0.

 

Any help will be appreciated!  

 

Best regards,

Paweł.



[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 681 posts
  • Corona SDK

Corona is still working on target version 26. I am actually surprised you got this far. They will notify us when it is ready for testing. Ignore all this if you are in some internal testing group that I am not aware of.



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

You cannot just select an SDK target with Corona. As @agramonte states, we are working on adding support for SDK version 26, but for now you should not be running apktool and making manual changes to your project.

 

Rob



[TOPIC: post.html]
#4

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 12 posts
  • Corona SDK

OK i get it, so when you will add support to target version 26, then you will also fix OneSingal Plugin to support Android 8.0? Good to hear that you working on adding that support! 

 

@Rob: I know i shouldn't make any manual changes in created .apk and i don't do it. I was just curious what android:targetVersion is in .apk build by latest Corona Daily Build. My native project is working on old Corona version 2017.3079 so i wanted to check if newest daily build support version 26 already.



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

  Best Answer

OneSignal maintains their own plugin. It will be up to them to update it after we enable SDK version 26.

 

Rob



[TOPIC: post.html]
#6

p.kanarek

[GLOBAL: userInfoPane.html]
p.kanarek
  • Observer

  • 12 posts
  • Corona SDK

@Rob. Good to know. Thank You very much for answering! So for now my topic is resolved. 



[TOPIC: post.html]
#7

bbk

[GLOBAL: userInfoPane.html]
bbk
  • Enthusiast

  • 37 posts
  • Corona SDK

Will the warning from Google Play - that the App has to support SDK 28 in August - automatically disappear when I build with the new version of Corona SDK (when it appears) ?



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

Once we release support for that API level, if you rebuild your app, that warning should disappear.

 

Rob



[TOPIC: post.html]
#9

MBD

[GLOBAL: userInfoPane.html]
MBD
  • Contributor

  • 384 posts
  • Corona SDK

We have encountered this and can't see a way around it - has this bug seen any movement yet?



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,328 posts
  • Corona Staff

We have reached out to OneSignal to see if we can get an update. I'll update here when I hear something. You probably should reach out to OneSignal as well.

 

Rob



[TOPIC: post.html]
#11

fixr

[GLOBAL: userInfoPane.html]
fixr
  • Observer

  • 5 posts
  • Corona SDK

Hi Rob, I have the same error of first post with onesignal plugin. The app crash if it's on background and when receive a push from onesignal.

AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.onesignal.GcmBroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=xxx/com.onesignal.GcmIntentService (has extras) }: app is in background uid UidRecord{3ec248 u0a370 RCVR idle procs:1 seq(0,0,0)}

I have the latest version of corona sdk (daily build). The plugin is updated?




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: onesignal, gcmintentservice, targetsdkversion, push