I'm having trouble getting a second notification to show up after the first one was successful.

In my code, I set the OpenDirect Activity:

.setOpenDirectRecipient(OpenDirectActivity.class).build(), this);

Then my Open Direct Activity looks like this:

public class OpenDirectActivity extends AppCompatActivity {

    View openDirectNavClose;

    WebView openDirectWebView;

    TextView openDirectTitle;

    protected void onCreate(Bundle savedInstanceState) {
        openDirectTitle.setTypeface(TypefaceService.INSTANCE.get(FuniApplication.get(), FontCatalog.OPENSANS_REGULAR));
        final NotificationMessage notificationMessage = NotificationManager.extractMessage(getIntent());
        String url; // = "http://www.funimation.com";
        if (notificationMessage != null && notificationMessage.type() == NotificationMessage.Type.OPEN_DIRECT) {
            url = notificationMessage.url();
            if(!TextUtils.isEmpty(url)) {
                openDirectWebView.setWebViewClient(new WebViewClient());

                final WebSettings webSettings = openDirectWebView.getSettings();
                openDirectNavClose.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {
            else {
        } else {

    public void onBackPressed() {

    private void closeActivity() {
        if(OpenDirectActivity.this.isTaskRoot()) {
            final Intent splashIntent = new Intent(this, SplashActivity.class);

As you can see, I call isTaskRoot() to see if the Activity is the only one that is open. If it is, that means, the app was closed. So I launch my default Activity when backing out. The problem is, once I launch my default Activity, clicking on notifications do not launch the Open Direct Activity anymore. I have to kill the app to get them to work again. Also, if I'm displaying my WebView when I click on a different notification, the OpenDirect Activity does not respond.

  • What version of the SDK are you using? Aside from how you want the back button to function, do you have any issues if you do NOT override the default open direct handling? (Do not provide a recipient and let the SDK handle the displaying of the notification.) – Bill Mote Jan 30 '18 at 19:07
  • I'm using v5.4.2. I have a design requirement to place an ImageButton and a TextView above the WebView. If there are ways to "skin" the popup and launch the default Activity, I'm all for it. – user3702285 Jan 30 '18 at 19:36
  • IDK what to tell you as the default presenter handles the notifications without incident -- regardless of how many you send it. I can't help with code outside the SDK. Public example that overrides notification handling without incident: github.com/salesforce-marketingcloud/LearningAppAndroid/blob/… and github.com/salesforce-marketingcloud/LearningAppAndroid/blob/… – Bill Mote Jan 30 '18 at 23:03
  • Thanks Bill. Is there a way to customize the Presenter? Or maybe create a subclass of DefaultUrlPresenter and customize it there? I just need to draw a button at the top. – user3702285 Jan 31 '18 at 21:26
  • Providing your own presenter will work as you have already done, but something in your code just isn't playing nicely. Have you looked through the logs to see what's happening? Enable logging in the SDK. You should see the push notifications being received and you should be able to track down whatever your application is doing as a result. – Bill Mote Feb 1 '18 at 2:37

Your Answer

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

Browse other questions tagged or ask your own question.