Application running in background in android -


i want run application in background. want make application when battery down specific level have send sms someone. if phone on standby or playing game , battery level reach 5% have send sms. want know how run application in background??

if (btrylevelorig==batterylevel) {         toast.maketext(getapplicationcontext(), "level", toast.length_short).show();         sendsms();     } 

you have use android service . if have show user interaction notification, can run service foreground using startforeground

check link create own background custom service. make sure onstartcommand return start_sticky run service continuously .

http://developer.android.com/guide/components/services.html


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -