单击通知时,android应用程序中未打开目标活动
此方法在我的服务中------>>> 公共类MyFirebaseMessagingService扩展了FirebaseMessagingService 单击通知时,我的目标活动(事件)未打开单击通知时,android应用程序中未打开目标活动,android,notifications,Android,Notifications,此方法在我的服务中------>>> 公共类MyFirebaseMessagingService扩展了FirebaseMessagingService 单击通知时,我的目标活动(事件)未打开 //This method is only generating push notification //It is same as we did in earlier posts private void sendNotification(String messageBody) { Inten
//This method is only generating push notification
//It is same as we did in earlier posts
private void sendNotification(String messageBody) {
Intent intent = new Intent(getApplicationContext(), Events.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.mipmap.djchc_logo)
.setContentTitle("Notification")
.setContentText(messageBody)
//.setAutoCancel(true)
.setSound(defaultSoundUri);
//.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}