Original: http://blog.csdn.net/kevinmeng_ini58/article/details/7700786
Fragment One:
[HTML]View Plaincopy
- <!--boot-up
- <receiver android:name=". Autostartreceiver ">
- <intent-filter>
- <action android:name="Android.intent.action.BOOT_COMPLETED"/>
- <category android:name="Android.intent.category.HOME"/>
- </intent-filter>
- </receiver>
Android:name= ". Autostartreceiver "Autostartreceiver.java to handle the operation after boot start
Fragment two: in 4. X version on the test must be added to the sentence, test equipment, the original road N90 8G
[HTML]View Plaincopy
- <!--boot-up
- <uses-permission android:name="Android.permission.RECEIVE_BOOT_COMPLETED" />
Fragment Three: Autostartreceiver.java
[Java]View Plaincopy
- Import Android.content.BroadcastReceiver;
- Import Android.content.Context;
- Import android.content.Intent;
- /**
- * Enable Boot
- * @author Owner
- */
- Public class Autostartreceiver extends Broadcastreceiver {
- @Override
- public void OnReceive (context context, Intent Intent) {
- Intent i = new Intent (context, mainactivity. Class);
- I.setflags (Intent.flag_activity_new_task);
- Context.startactivity (i);
- }
- }
Android Development Settings Start automatically