Question

I have an android app, and I want that the user can decide when (day,hour,and minute) to do something. So, I have to: 1) start a service when the android phone boots and when the user runs the app (for example after the installation)

2) check (how? how many often?) if the current time is the time choosed by the user

3) run a method if the time is right.

I searched a lot, and I'm a bit confusing... I found that I have to use a BroadcastReceiver to check when the phone boots,then start an IntentService to have a background process that's check if the time is a "choosen time" and then call the method. Am I right?

But how do I check the time? How many often should I do that?

Was it helpful?

Solution

You're right. You can use a BroadcastReceiver to check for boot. As for the chosen time, I recommend that you use the AlarmManager class to have your Service run at a particular time or interval.

ref: http://developer.android.com/reference/android/app/AlarmManager.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top