[Summary] the android program does not display the icon and starts automatically upon startup? Let me tell you

Source: Internet
Author: User

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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.