The following are the specific practices:
1.  set flag_persistent : in androidmanifest.xml file, add android:persistent=" true " 
2. set flag_ SYSTEM : Put your written application into /system/app/ The directory can be. This is done as follows:
a. use cygwin or cmd Enter your project's bin directory, then execute the following two commands:
Adb remount
adb push yourpackage.apk /system/app/
command adb remount To get temporary operation permissions for the system directory, and then use push command to upload your own package to the System application directory.
B. Restart your phone. After booting, you can see the program you wrote in the app list.
adb install yourpackage.apk to install apk package, All we need to do is apk package copy to /system/app/ adb install flag_system flag will not be set, Span style= "Font-family:courier New" >flag_persistent logo will also have no effect.
C. If you need to uninstall your own written system application, execute the following command:
ADB remount
ADB Shell rm/system/app/yourpackage.apk
Also, it should be noted that if you want to add your own written system-level application in the emulator, as if it is not possible, because the apk copied to the /system/app/ , but also must restart, but the simulator restarts, The system directory will also revert to its original state. But online seems to have been done, the method is also very simple, is the Android source code corresponding place slightly changed, and then recompile ...
How to make your Android program, service never be killed by the system