Marketo/android-sdk

Crashing App after receiving push on Android 8.0

Closed this issue · 6 comments

Here is the stack trace:

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.marketo.MarketoBroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.fivestars.mma cmp=com.fivestars.mma/com.marketo.MarketoIntentService (has extras) }: app is in background uid UidRecord{c72cc0e u0a179 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)
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.fivestars.mma cmp=com.fivestars.mma/com.marketo.MarketoIntentService (has extras) }: app is in background uid UidRecord{c72cc0e u0a179 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
       at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1521)
       at android.app.ContextImpl.startService(ContextImpl.java:1477)
       at android.content.ContextWrapper.startService(ContextWrapper.java:650)
       at android.content.ContextWrapper.startService(ContextWrapper.java:650)
       at marketo.push.MktoWakefulBroadcastReceiver.a(SourceFile:86)
       at com.marketo.MarketoBroadcastReceiver.onReceive(SourceFile:42)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)
       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)

Fix might me moving from IntentService to JobIntentService.

Thank you for pointing this out, our team is working on it and will post an update soon.

Thanks @peperodo for looking into it. Any ETA, I should expect here?

I'm running into this issue also, I'm pretty sure this is the fix for it https://developer.android.com/about/versions/oreo/android-8.0-changes.html#back-all

The most recent build of the SDK that supports Android 8.0:
https://github.com/Marketo/android-sdk/tree/preprod

I still have issues with Android 8.1 in version v0.7.6

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
                      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(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

If I set my targetSdkVersion to 26 instead of 27 it works, but that isn't an ideal solution.

The most recent build (0.7.7 in preprod branch) of the SDK that supports Android 8.0: