I create a notification that triggers an intent. Here is a really shortened snippet of my code ...
Notification notification = new Notification(R.drawable.icon, "notification", System.currentTimeMillis()); NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Intent notificationIntent = new Intent(BackgroundService.this, ConnectionHandler.class); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationIntent.addFlags(Intent.FLAG_FROM_BACKGROUND); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); notification.setLatestEventInfo(context, getString(R.string.notification_title), getString(R.string.notification_body), pendingIntent); notification.flags |= notification.FLAG_AUTO_CANCEL; nm.notify(1, notification);
In my intention ( ConnectionHandler.class
) I would like to show an AlertDialog that works. But I would like AlertDialog to be displayed without opening a new user interface. Best for me was if AlertDialog just appears without any others when I click on a notification.
Any idea is welcome.
Regards, Toby
Atmocreations
source share