點擊後不關閉的通知欄我BrodcastReceiver
創建通知onReceive
並點擊它後調用另一個接收機,它出現在通知進步下載;怎麼說被通知
我不需要點擊後,關閉通知抽屜。我該怎麼做?
@Override
public void onReceive(final Context context, Intent intent) {
Log.v(TAG, "show first notification");
final Notification.Builder mBuilder;
final NotificationManager mNotifyManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new Notification.Builder(context);
Intent resultIntent = new Intent(context, SecondReceiver.class);
resultIntent.setAction("second notif");
PendingIntent resultPendingIntent =
PendingIntent.getBroadcast(
context,
0,
resultIntent,
0
);
mBuilder.getNotification().flags |= Notification.FLAG_NO_CLEAR;
mBuilder.setContentIntent(resultPendingIntent)
.setContentText("Tap")
.setSmallIcon(R.drawable.ic_launch)
.setAutoCancel(
mNotifyManager.notify(1, mBuilder.build());
}
附:點擊通知我開始下載並顯示進度 – user3927708