Reputation: 1249
i made an application which keep the screen awake, and it works fine until it gets killed by the system. How can i keep my app running in background? I see a lot of apps that uses notifications to stay running and avoid being killed, but i don't know how to implement it. Can someone help me achieve this?
Upvotes: 0
Views: 476
Reputation: 218
Use Android Services.You can use the following methods:-
Its good to be cautious when using any Sensors to run in the background as it might eat up you battery fast
Upvotes: 0
Reputation: 6605
Services or AlarmManager is what you are looking for I think, depends on what you want to do..
Upvotes: 0
Reputation: 65843
You can use the Service API for this, specifically the startForeground(int, Notification) function call. There is an example provided in the API documentation that I have linked to.
Upvotes: 1