You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver...

31 lines
825 B
Java

package org.tasks.notifications;
import android.content.Context;
import android.content.Intent;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import javax.inject.Inject;
import timber.log.Timber;
public class NotificationClearedReceiver extends InjectingBroadcastReceiver {
@Inject NotificationManager notificationManager;
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
long notificationId = intent.getLongExtra(NotificationManager.EXTRA_NOTIFICATION_ID, -1L);
Timber.d("cleared %s", notificationId);
notificationManager.cancel(notificationId);
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
}