The source code is downloaded in the personal file:
Startapp.rar
Here is the configuration file:
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.android.startapp"Android:versioncode= "1"Android:versionname= "1.0" > <uses-SDK Android:minsdkversion= "8"android:targetsdkversion= "/>" <uses-permission android:name= "Android.permission.RECEIVE_BOOT_COMPLETED" > </uses-permission& Gt <Application Android:icon= "@drawable/ic_launcher"Android:label= "@string/app_name" > <Activity Android:name= "Com.android.startapp.MainActivity"Android:label= "@string/app_name" > <intent-filter> <action android:name= "Android.intent.action.MA In "/> <category android:name=" Android.intent.category.LAUNCHER "/> </intent-filter& Gt </activity> <receiver android:name= "Com.android.reserver.StartReceviver" > <intent-filter > <action android:name= "Android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> </application></manifest>
This is the service class
PackageCom.android.reserver;Importcom.android.startapp.MainActivity;ImportAndroid.content.BroadcastReceiver;ImportAndroid.content.Context;Importandroid.content.Intent;/*** Inherit a service that catches the boot first service * *@authorCatherine.brain * **/ Public classStartreceviverextendsBroadcastreceiver {/**define an action*/ Static FinalString ACTION = "Android.intent.action.BOOT_COMPLETED"; @Override Public voidOnReceive (Context context, Intent Intent) {if(Intent.getaction (). Equals (ACTION)) {Intent sayhellointent=NewIntent (context, mainactivity.class); Sayhellointent.addflags (Intent.flag_activity_new_task); Context.startactivity (sayhellointent); } }}
Here are the main classes:
PackageCom.android.startapp;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.os.Handler;ImportAndroid.view.Window;ImportAndroid.view.WindowManager;ImportAndroid.widget.ImageView;/*** This is a application of the start phone * *@authorCatherine.brain **/ Public classMainactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); //Setcontentview (r.layout.activity_main);requestwindowfeature (Window.feature_no_title); GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); /**Customize a picture, and then load*/ImageView Image=NewImageView ( This); Setcontentview (image); Image.setbackgroundresource (R.drawable.ic_launcher); Mythread.start (); } Thread MyThread=NewThread () { Public voidrun () {Try{sleep (5000); } Catch(interruptedexception e) {//TODO auto-generated Catch blockE.printstacktrace (); } finally{myhandler.sendemptymessage (EXIT); } }; }; Public Static Final intEXIT = 0x0001; Handler MyHandler=NewHandler () { Public voidhandlemessage (android.os.Message msg) {Switch(msg.what) { CaseEXIT:/**The time is to shut down*/System.exit (0); Break; default: Break; } }; };}
Android Boot program (custom Oh!) )