开发者

Android -- launching app when system boot

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜