2017-02-12 73 views
-4

對於我的應用程序,我需要不同時間的不同通知。假設我在上午11點,上午12點,下午1點設置通知,所以一個bt只給最後一個通道。我使用下面的代碼在android中的自定義通知

Intent intent = new Intent(context, MediaActivity.class); 
    RQS = (int) System.currentTimeMillis(); 

    PendingIntent pIntent = PendingIntent.getActivity(context, RQS, intent, 
      PendingIntent.FLAG_UPDATE_CURRENT); 

NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); 
    mNotificationManager.notify(1, mBuilder.build()); 

我已聲明 private int RQS_1;在MainActivity中 我該如何解決它?

+0

歡迎來到計算器。你的問題標題沒有描述你的問題,而且問題是模糊的,寫得不好。請參考[我如何提出一個好問題? FAQ](http://stackoverflow.com/help/how-to-ask),然後再改進你的問題。 –

回答

0

您使用的是相同的通知ID爲所有3.當你用相同的ID,您覆蓋舊與新的。如果你想讓所有3個人堅持下去,請使用不同的ID。

+0

你會詳細解釋與example.i我不清楚這一點。 – rabiulcse17

+0

閱讀文檔。 https://developer.android.com/reference/android/app/NotificationManager.html#notify(int,android.app.Notification) –