0

I have an app set up for Android, and it's working well except for 1 thing,when I override and customize the notification builder, the android app is not counting when the user opens the notification, then MarketingCloud does not take that into the % of opens.

Is there an specific setup that we need to do, or an specific line that I might have missed on the docs that does the trick?

  • 1
    Can you update your question with the code from your NotificationManager.NotificationBuilder implementation? – Seth Aug 17 '18 at 14:58
  • Please check my my question soon @@ Thanks in advance – Nguyễn Đại Dương Aug 20 '18 at 3:37
  • I updated my question below :D – Nguyễn Đại Dương Aug 20 '18 at 8:26
1

Thank you for the code. There are a couple issues here.

  1. Your implementation of the NotificationManager.NotificationBuilder interface should not display the notification itself. This will be done be the SDK using the returned NotificationCompat.Builder from the setupNotificationBuilder method.
  2. If DisplayMessageActivity is the only Activity you use for notification clicks then you can just set it with setNotificationRecipient in the MarketingCloudConfig. If your application has custom logic to determine which Activity should be used based on the incoming message then you can implement the NotificationManager.NotificationLaunchIntentProvider and return a different destination based on the NotificationMessage. The SDK will use either of these to set the contentIntent on the notification builder that is returned in setupNotificationBuilder.
0

Dear @Seth here is my code :

public class MyApplication extends MultiDexApplication implements NotificationManager.NotificationBuilder{
public void onCreate() {

 //init
 MarketingCloudSdk.init(this, MarketingCloudConfig.builder().setApplicationId(Utils.SL_APP_ID)
            .setAccessToken(Utils.SL_ACCESS_TOKEN)
            .setGcmSenderId(Utils.SENDER_ID)
            .setAnalyticsEnabled(true)
            .setNotificationBuilder(this)
            .build(), this);

}

@Override
public NotificationCompat.Builder setupNotificationBuilder(final @NonNull Context context, @NonNull NotificationMessage notificationMessage) {
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context);

Intent  resultIntent = new Intent(context, DialogMessageActivity.class);

   ...              
 NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
                mNotificationManager.notify((int) System.currentTimeMillis(), notificationBuilder.build());                     

 return notificationBuilder ;
}

}

0

Thanks for your answer! And in the other case, when I want to display a message dialog instead of notification view in case of apps is in the foreground (apps is opening). In this case, the notification can not be analyzed, is it? I desire a public method which can analytics the notification bundle content anywhere, is it possible?

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.