开发者

How will my app receive an intent broadcasted by AlarmManager if the OS has closed my due to memory crunch

I am writing an alarm app, and would like to do some specific work when the alalrm is triggered. For this I use the AlarmManager.set() method and the pending intent broadcasts the intent. So far so good. But what if the OS decides to close my app which was in background due to memory crunch. Could someone help me with this.

Also if I want repeat开发者_StackOverflow中文版ed alarms then I can use the AlarmManager.setRepeating(). Does this take into consideration the day light saving adjustment ?


The Alarm will start your application even if this isn't currently running. In order for this to happen you need to register a broadcast receiver either with the <receiver> tag in the manifest file or with the registerReceiver method. Read the documentation for details.

As for your second question, although I haven't tried it, with setRepeating you configure the interval between subsequent alarms. If for example you have your first alarm at 13:00 and use an INTERVAL_DAY interval, the alarm will fire every day at 13:00. If daylight savings take affect and 13:00 becomes 12:00, then the alarm will fire daily at 12:00. However, I suppose you need to try this out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜