Как при клике на уведомления (Notification) запустить нужное activity даже если приложение не запущенно?
Вот мой отображения уведомления:
private void sendNotification(String url_post, String thumb_post, String message_title, String message_body) {
Intent intent = new Intent(this, SinglePostActivity.class);
intent.putExtra("_post_url", url_post);
intent.putExtra("_post_title", message_body);
intent.putExtra("_toolbar_title", message_body);
intent.putExtra("_toolbar_thumb", thumb_post);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.beloweb_icon_small)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setContentTitle(message_title)
.setContentText(message_body)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
.setWhen(System.currentTimeMillis())
.setDefaults(Notification.DEFAULT_SOUND)
.setVibrate(new long[]{100, 600, 500, 600})
.setLights(Color.GREEN, 400, 400)
.setTicker(message_body);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notificationBuilder.build());
}