I don't know how to launch activity every 5 minutes by using services and broadcast receiver. When i want to click on button start the service and it's call every 5 minutes and reopen my application if user can close application or kill process.For this which type of actions can i perform and what are the permissions can i take and which methods can i use.Anybody please help me.
use timer task class as and call it every 5 seconds
class RemindTask extends TimerTask {
@Override
public void run() {
System.out.println("ReminderTask is completed by Java timer");
Intent dialogIntent = new Intent(getBaseContext(), myActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(dialogIntent);
}
}
call to timer task as
ReminderTask timer = new Timer(); //At this line a new Thread will be created
timer.schedule(new RemindTask(), 5*1000, 5*1000); //delay in milliseconds