I am making an android app which reminds people via notifications of events they have to do over the course of a day. The way I currently do this is have each 开发者_StackOverflow社区event on a seperate timer using the Timer class. However, I don't think this is great way of doing things. Is there any way maybe to have just one timer which will trigger an event at each time interval I pass in? Or is there any other way of scheduling a notification?
You should look at AlarmManager : http://developer.android.com/reference/android/app/AlarmManager.html
This way events can be notified even if your app is not in focus.
精彩评论