Ich habe eine Android-App mit Push-Benachrichtigungen. Ich habe ein Problem mit einigen Geräten. Wenn ich eine Push-Benachrichtigung sende, wird die App des Benutzers automatisch geöffnet. Ich will das nicht machen. Ich möchte, dass die Benachrichtigung normal angezeigt wird und wenn die Nutzer darauf klicken, wird die App geöffnet.Wie man Push Notification von automatischem Öffnen der App stoppt?
Wie verhindere ich, dass die App automatisch geöffnet wird? Hier
ist der Code von meiner Absicht für Push-Benachrichtigungen:
Intent notificationIntent = new Intent(this, MainActivity.class);
notificationIntent.setFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, requestID, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
// Display a notification with an icon, message as content, and default sound. It also
// opens the app when the notification is clicked.
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(message)
.setColor(0xFF221E80)
.setDefaults(Notification.DEFAULT_SOUND)
.setAutoCancel(true)
.setFullScreenIntent(contentIntent, true)
.setContentIntent(contentIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(
Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, builder.build());
Danke! Ich weiß wirklich nicht, wie das unbemerkt geblieben ist! Arbeiten wie erwartet jetzt! =) – filipebarretto
Kein Problem, alles funktioniert, Happy Coding! – Bobbake4