here is what am trying to accomplish and badly failing at it.
I need to:
-start a service
-do some tasks
-set AlarmManager to start the service again after a set period of time
-stop the service
the problem I'm having is that the service is being re-started almost immediately it is being stopped. All I want is that the service should start after the alarm goes off..
Here is the code:-
Intent intent = new Intent(ThisService.this,
ThisService.class);
PendingIntent pendingIntent = PendingIntent.getService(ThisService.this, 0,
intent, PendingIntent.FLAG_CANCEL_CURRENT);
alarmManager.cancel(pendingIntent);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
getUpdateTime(), getUpdateTime(), pendingIntent);
stopSelf();
what you are missing is the broadcast reciever
The flow should be
please refer to http://www.vogella.com/articles/AndroidBroadcastReceiver/article.html