Just modified your code,
public void setAlarmManager(boolean cancel){
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,downloader,PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
int delay = Integer.parseInt(perMin.getSelectedItem().toString());
if(!cancel)
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,10 * 1000, delay * 1000, pendingIntent);
else
alarmManager.cancel(pendingIntent);
}
call this function when needed,
to Start: setAlarmManager(false);
to Cancel: setAlarmManager(true); //Call this function in Service
Try, this may work. Thanks.