I need to repeat alarm every one second until 3 minutes After that automatically cancel the alarm
Here is some of the code I have been Implemented:
Intent intent = new Intent(activity, MyReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(activity,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager mAlarmManager = (AlarmManager)(activity.getSystemService( Context.ALARM_SERVICE ));
mAlarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),10000,pendingIntent);
I have to use cancel() method for cancellation. But I'm not sure where I have to implement this method?