简体   繁体   中英

how can i register TIME_TICK event broadcast receiver for android app even if app is running or not

i want to fire some event when system time matches the time stored in my database.I tried out this by using TIME_TICK broadcast receiver.when this receiver receive broadcast, i match my database entries with system time...but problem is that i can register this broadcast receiver from activity only...can't register from manifest file.so, when i close my app or remove it from recent apps list, this broadcast receiver stops working. I refer the documentation that says that "TIME_TICK can only register from activity , not from manifest file". I also tried to find solution for my problem on stackoverflow and on google but i can't found proper answer. so, if you know how to solve it then reply my question and thanks in advance.

i want to fire some event when system time matches the time stored in my database

Use AlarmManager .

how can i register TIME_TICK event broadcast receiver for android app even if app is running or not

That is not possible, as it is incredibly inefficient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM