作者:娱乐老爷_410 | 来源:互联网 | 2023-07-10 10:01
在通过Firebase收到推送通知后,我正在使用前向移动到其他活动。我尝试了几乎所有解决方案,但无论是从Firebase消息传递还是从常规触发,它都处于相同的活动中。 PendingTicketFragment.class是mainactivity中的一个片段。
代码:-
Intent intent = new Intent(this,PendingTicketFragment.class);
intent.setflags(Intent.flaG_actIVITY_NEW_TASK | Intent.flaG_actIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getactivity(this,1 /* Request code */,intent,PendingIntent.flaG_ONE_SHOT);
Uri defaultsoundUri = RingtoneManager.getDefaulturi(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificatiOnBuilder= new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.logo_river)
.setContentTitle("CEMpia Message")
.setContentText("CEMpia Ticket Escalated to you for"+" "+lp.getusername())
.setautoCancel(true)
.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.logo_river))
.setsound(defaultsoundUri)
.setContentIntent(pendingIntent);
Notificationmanager notificatiOnmanager= (Notificationmanager) getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationmanager != null;
notificationmanager.notify(1 /* ID of notification */,notificationBuilder.build());