标签:
权限<uses-permission android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"/
>
<span style=
"color: #ff00ff;"
><receiver android:name=
".BootBroadcastReceiver"
>
<intent-filter>
<action android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<category android:name=
"android.intent.category.HOME"
/>
</intent-filter>
</receiver>
public
class
BootBroadcastReceiver
extends
BroadcastReceiver {
static
final
String action_boot=
"android.intent.action.BOOT_COMPLETED"
;
@Override
public
void
onReceive(Context context, Intent intent) {
if
(intent.getAction().equals(action_boot)){
Intent ootStartIntent=
new
Intent(context,BootStartDemo.
class
);
ootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(ootStartIntent);
}
}
}
标签:
原文地址:http://www.cnblogs.com/lzh-Linux/p/4457151.html