1

We are getting the following crash when targeting Android O (Oreo) when using the Marketing Cloud Mobile Push Android SDK v5.2.x 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:

java.lang.IllegalStateException: A channel name must be provided when target SDK version is at least Android O.
                                         at com.salesforce.marketingcloud.notifications.NotificationManager.a(Unknown Source:19)
                                         at com.salesforce.marketingcloud.notifications.NotificationManager.a(Unknown Source:4)
                                         at com.salesforce.marketingcloud.MarketingCloudSdk.f(Unknown Source:309)
                                         at com.salesforce.marketingcloud.MarketingCloudSdk.b(Unknown Source:43)
                                         at com.salesforce.marketingcloud.MarketingCloudSdk.a(Unknown Source:0)
                                         at com.salesforce.marketingcloud.MarketingCloudSdk$1.run(Unknown Source:38)
                                         at java.lang.Thread.run(Thread.java:764)
  • Can you please provide some more information about your environment as well as how you are configuring the Marketing Cloud Mobile Push SDK? – Brian M. Criscuolo Oct 27 '17 at 14:58
  • See edits @BrianM.Criscuolo – TroubledUser Oct 27 '17 at 15:05
1

When targeting Android O (or higher) you must choose between one of two options for dealing with notification channels while initializing the SDK.

Option 1: Use the default channel configuration provided by the SDK by simply providing the user facing channel name for that channel.

Option 2: Provide an implementation of the NotificationChannelIdProvider which will allow you to choose which of the notification channel you've set up should be used on a per message basis.

If neither option is selected during the SDK initialization then the IllegalStateException you reported will be thrown. This is because without make a choice the SDK will not be able to show notifications on Android O devices.

See http://salesforce-marketingcloud.github.io/JB4A-SDK-Android/notifications/custom-channels.html for more information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.