DeleteIntent
: это объект PendingIntent
, который может быть связан с уведомлением и срабатывает при удалении уведомления, эфир:
Пользовательское действие Пользователь Удалить все уведомления.Вы можете установить Pending Intent равным BroadcastReceiver
и затем выполнить любое действие, которое вы хотите.
Intent intent = new Intent(this, MyBroadcastReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 0, intent, 0);
Builder builder = new Notification.Builder(this):
..... code for your notification
builder.setDeleteIntent(pendingIntent);
И в других местах, чтобы прослушивать всякий раз, когда ваше Уведомление было закрыто / удалено.
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
.... code to handle cancel
}
}