I am trying to stop the alarm and checking it whether it stopped or not, but it always returns true means alarm is working. I tried to stop the alarm based on the answer in
You have to pass different id for set alarm
PendingIntent.getBroadcast(ctx, id, intent,PendingIntent.FLAG_UPDATE_CURRENT);
For cancel alarm you have pass same
idthat you used for set
.
PendingIntent pendingIntent = PendingIntent.getBroadcast(ctx, id,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) ctx
.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);