[英]trying to save value of my edit text field after changing to one activity to 2nd activity and then return to 1st activity in jetpack compose
[英]Trying to Create Two services in my application and send notifications from each, but the 2nd one replaces the 1st
我正在努力在應用程序中創建第二個服務,由於它的工作與第一個完全不同,因此我希望他們發送單獨的,不相關的通知。 但是,第二條通知似乎正在替換我狀態欄中的第一條通知。
這是我的第一個服務的通知代碼,似乎運行良好:
private void showNotification()
{
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder (this)
.setAutoCancel (true)
.setSmallIcon (R.drawable.icon)
.setWhen (System.currentTimeMillis())
.setContentTitle ("TCP Server Service Started");
TaskStackBuilder stackBuilder = TaskStackBuilder.create (this);
stackBuilder.addNextIntent (new Intent (this, Launcher.class)); // This cannot be removed
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent (0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent (resultPendingIntent);
notificationMngr.notify (0, mBuilder.build());
}
我基本上是將角色提升為角色,然后將其粘貼到新的服務類別中。 是那些魔術零(在getPendingIntent()和notify()中)中的一個,我應該嘗試將其分開嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.