Abstract 1:
Abstract 2:
First, write a very simple program, just an Activity, which means that the title bar of this Activity is removed, and the background is completely transparent. Then, finish () yourself in OnCreate of this Activity and do nothing, in the Manifest. in xml, declare that the startup service is OK, and then respond to the startup service in the program.
Second, do not use the Activity. directly write the program as a Widgets ......
First, write a very simple program, just an Activity, which means that the title bar of this Activity is removed, and the background is completely transparent. Then, finish () yourself in OnCreate of this Activity and do nothing, in the Manifest. in xml, declare that the startup service is OK, and then respond to the startup service in the program.
Second, do not use the Activity. directly write the program as a Widgets ......
If you still don't understand it, let's say, I'll write it for you. But after I write it out, you will lose a chance to study it...
Digest 3:
You can enable auto-start services without activity, but there is a problem, that is, it is okay if you start the service for the first time, but if you run this program on your mobile phone, after this program is deleted, you can only write one activity to start it. Then, you can comment out the activity in androidMenifest, and there will be no activity in the future.
I personally encountered a lot of difficulties in starting the Android system without icons. No Activity is found and the service cannot be automatically run after the Activity is started. Later, I found that the service can be started occasionally without icons. Wondering
It turns out that my previous program had an Activity with a graphic, And I installed
<intent-filter> <action android:name="android.intent.action.MAIN" /> <!-- <category android:name="android.intent.category.LAUNCHER" /> --> </intent-filter>
In
<category android:name="android.intent.category.LAUNCHER" />
Removed, the installation process is not to delete the installation, but to directly replace the installation, and then start the next boot, the program still starts running without the icon. Because you have run
To start the instance, you must solve the problem of starting the instance for the first time after installation!
Summary: http://bbs.csdn.net/topics/390216017