开发者

How to not get my alarm on its own way?

I'm using an Alarm Manager to trigger an IntentService every hour. However, originally the alarm gets registered when the user runs the app. The problem is that when the user opens the app again it makes the manager create a new service run and if the current service is already running they trip over each other because of the database connection an开发者_开发技巧d everything dies!

Another problem is that the alarm service completely stops. Why? I thought the alarm should go on every hour no matter what!


at the very beginning check for a existing database . if it doesn't exist. make a database and start the alarm. the next time the app start if it found a database it will not start the alarm again.
or use any saved value like we use semaphores check for value 0 or 1..
rest functionality of a Alarm manager is supposed to work properly

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜