I\'ve read through many questions and answers on Stackoverflow, and many of which just emphasize on the .cancel()
and the special unique ID. However, now matter
Well for cancelling Alarm you have to create the same PendingIntent that you created while starting it. You are doing while starting,
Intent intent = new Intent(pickTime.this, timesUp.class);
PendingIntent timesUpIntent = PendingIntent
.getService(pickTime.this, RQS_1, intent, 0);
You are doing while cancelling,
Intent intent = new Intent(this, pickTime.class);
PendingIntent timesUpIntent = PendingIntent
.getBroadcast(this, RQS_1, intent, 0);
Are they same?
No, they are not same. You are creating PendingIntent
for Service
to start and trying to cancel with different PendingIntent
of BroadCast
.