我寫推送通知在Android項目,在MyFirebaseMessagingService
服務寫這個代碼顯示了通知:爲什麼點擊通知時不顯示活動?
Intent intent = new Intent(getApplicationContext(), NotificationMessage.class); //
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(currentapiVersion)
.setContentTitle(this.getResources().getString(R.string.app_name))
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentText(msg)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_HIGH)
.setContentIntent(contentIntent);
mNotificationManager.notify((int) notificatioId, notificationBuilder.build());
時的主要活動表演,併發送推送,通知是展示和點擊重定向到NotificationMessage
活動,但是當我關閉主要活動並再次發送推送時,通知會顯示給我,但是當我點擊它時,重定向到主要活動並且不顯示NotificationMessage
活動,會發生什麼?我該如何解決問題?謝謝。
什麼是mNotificationManager? – behzad
requestID是什麼? – behzad