开发者

Android -- launching app when system boot

开发者 https://www.devze.com 2023-02-28 06:53 出处:网络
hey all, I have a app needed to be launched when system boot, Registering a BroadcastReceiver to receive RECEIVE_BOOT_COMPLETED Intent is a solution I have known,

hey all, I have a app needed to be launched when system boot, Registering a BroadcastReceiver to receive RECEIVE_BOOT_COMPLETED Intent is a solution I have known,

but I want to know how does the desktop app auto run from boot开发者_开发百科? I also want to know any other means available so that I can choose a suitable one for my scenario.

any replies will be welcome.


Write this code in manifest file...

receiver android:name=".AfterBoot"

            intent-filter               
                action android:name="android.intent.action.BOOT_COMPLETED" 
            intent-filter
receiver
uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"

-- AfterBoot.java file.......

public class AfterBoot extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
           // call your app launcher activity here ....
}
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号