2

I checked all the possible SO questions regarding notification not opening activity.

Not Opening the New Activity After Clicking on the Notification Android

Clicking notification not opening app/activity

Open application after clicking on Notification

http://www.vogella.com/tutorials/AndroidNotifications/article.html

Below is my code :

                        Intent resultIntent = new Intent(MainApplication.this, HomeActivity.class);
                        TaskStackBuilder stackBuilder = TaskStackBuilder.create(MainApplication.this);
                        stackBuilder.addParentStack(HomeActivity.class);
                        // Adds the Intent that starts the Activity to the top of the stack
                        stackBuilder.addNextIntent(resultIntent);
                        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);


                        NotificationCompat.Builder builder = new NotificationCompat.Builder(MainApplication.this);
                        builder.setContentTitle(notifMessage.getTitle())
                                .setContentText(notifMessage.getDescription())
                                .setAutoCancel(true);
                        builder.setContentIntent(resultPendingIntent);
                        NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                        nm.notify(0, builder.build());

and in AndroidManifest

<activity
        android:name=".HomeActivity"
        android:configChanges="locale|layoutDirection"
        android:screenOrientation="portrait"
        android:exported="true"/>

And still I can't manage to open the activity from notification.

Any idea what is wrong, can the issue be that I'm doing all this from MainApplication (in the OneSignal.startInit) and not from a service

Thanks

Community
  • 1
  • 1
Dany Y
  • 6,833
  • 6
  • 46
  • 83
  • Please explain in detail what you mean by "I can't manage to open the activity from notification". – CommonsWare Sep 26 '16 at 17:11
  • There is no way to log what's happening, but simple when the notification is showing on the status bar, i click on it. the notification disappears but the application doesn't launch. – Dany Y Sep 26 '16 at 18:29

0 Answers0