Search code examples
androidalarmmanagerandroid-pendingintent

Does AlarmManager clear previously set intents when application reinstalled in debug mode?


I have an Activity that sets PendingIntent with some interal via AlaramManager, but as I sometimes see, when I change intent, receiver still getting old intents with some extra data, that can cause a problem.

Could it be possible and how to avoid this situation?

Sorry can't find enought information on this case. Thanks in advance!

Intent intent = new Intent(context, PollingService.class);
    intent.setAction(PollingService.ACTION_POLL);

    pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, Constants.ALARM_TRIGGER_AT_TIME, Constants.ALARM_INTERVAL, pendingIntent);

Solution

  • Thats a difficult question. From what I understand some Intent objects can be "Sticky". Allowing them to persist in some ways. In this case I would assume it does not kill them off because they are using a System Service rather than something from an Activity or Service from your App. I would use the adb uninstall (package name) command in the command prompt to completely remove your app from the device.