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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -