java - how to make our app to start automatically? -


i have apk runs on background. want start every x seconds.

i can terminal sh command:

#!/bin/bash while true start --user 0 -a android.intent.action.main -n com.xxxxxxx/.mainactivity sleep 20 done 

but after reboot stops running automatically. besides, don't want use sh command everytime. decompiled apk apktool. need add make our app start self every x seconds?

p.s. know if save commands sh file etc/init.d/ it'll persistent i'm trying learn how can add source.

what need add make our app start self every x seconds?

you need schedule alarmmanager. can find more here.

but after reboot stops running automatically.

you need register receiver android.intent.action.boot_completed app invoked after boot. can find answer here. when receiver invoked, can again schedule app restarting.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -