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 ....
}
}
精彩评论