0
我想在Android上顯示一個簡單的本地通知消息。這裏是我的代碼,但我無法使它工作。Android - notificationManager.notify不顯示通知
沒有行動:
final Context context = this;
Intent intent = new Intent(this, MainActivity.class);
final PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0);
Notification n=new Notification.Builder(context)
.setContentTitle("Nabeeer?")
.setContentText("Iceriiik")
.setContentIntent(null)
.setContentIntent(pIntent)
.setAutoCancel(true)
.build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, n);