Я создаю уведомление, которое запускает Намерение. Вот действительно сокращенная выдержка из моего кода ...
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);
В своем намерении (ConnectionHandler.class
) я хотел бы показать AlertDialog, который работает. Но я бы хотел, чтобы AlertDialog отображался без открытия нового окна пользовательского интерфейса. Лучшим для меня было бы, если AlertDialog просто появляется без чего-либо еще при нажатии на запись уведомления.
Любая идея приветствуется.
С уважением, Тоби