2

When using Marketing Cloud Mobile Push Android SDK v5.1.x and targeting Android O (Oreo) and initializing with:

  MarketingCloudSdk.init(this, MarketingCloudConfig.builder()
      .setApplicationId("OUR ID")
      .setAccessToken("OUR TOKEN")
      .setGcmSenderId("OUR GCM SENDER ID")
      .setAnalyticsEnabled(true)
      .build(), new MarketingCloudSdk.InitializationListener() {
    @Override public void complete(InitializationStatus status) {
      //no-op
    }
  });

We get the following error:

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.salesforce.marketingcloud.MCReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.salesforce.marketingcloud.BEHAVIOR_NOTIFICATION cmp=com.sample.myapp.activities/com.salesforce.marketingcloud.MCService (has extras) }: app is in background uid UidRecord{e8eb1f3 u0a120 TRNB idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3259)
at android.app.ActivityThread.-wrap17(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Caused by java.lang.IllegalStateException: Not allowed to start service Intent { act=com.salesforce.marketingcloud.BEHAVIOR_NOTIFICATION cmp=com.sample.myapp.activities/com.salesforce.marketingcloud.MCService (has extras) }: app is in background uid UidRecord{e8eb1f3 u0a120 TRNB idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
at android.app.ContextImpl.startService(ContextImpl.java:1461)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:99)
at com.salesforce.marketingcloud.MCReceiver.onReceive(Unknown Source:87)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3252) at android.app.ActivityThread.-wrap17(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

My app/build.gradle:

  defaultConfig {
    minSdkVersion 15
    targetSdkVersion 26
  }

and

dependencies {
  compile ('com.salesforce.marketingcloud:marketingcloudsdk:5.1.+') {
    exclude module: 'android-beacon-library' //remove to use Proximity messaging
    exclude module: 'play-services-location' //remove to use Geofence or Proximity messaging
  }
}
1
  • Off topic? Seriously. Come on guys. It's straight up Salesforce Marketing Cloud Mobile Push SDK related. Oct 30, 2017 at 19:24

1 Answer 1

1

Support for targeting Android O was not added to the Marketing Cloud SDK until version 5.2.0. Any attempts to use an older version of the SDK while targeting Android O will result in error you are seeing.

2
  • I updated the version, and got a worse error, now all my android versions are crashing. Going to review all the sdk installation
    – JRafaelM
    Mar 5, 2018 at 22:42
  • Can you create a new question with the stacktrace and details on when the crash occurs? Also, please provide the version of the SDK you're using.
    – Seth
    Mar 6, 2018 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .