简体   繁体   中英

No launcher icon

I have an interesting problem - at least for me. I don't want my application to have a launcher icon in the menu - I start it remotely and I don't want to show it up in the menu.

How can I solve that?

My idea is deleting the following from the manifest:

<intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Would this solve my problem?

Delete that:

 <category android:name="android.intent.category.LAUNCHER" />

And you won't have a launcher icon.

That's what i would do. This defines the gateway activity to your application and doesn't affect the functionality. If no activity has this filter, there won't be an icon to launch it manually, precisely what you want.

https://stackoverflow.com/a/13552763/6481542 is correct, but to address the Android Studio compilation issue noted in the comments, you need to modify the Run Configuration in Android Studio:

  • Go to Run -> Edit Configurations
  • Under Launch Options, change Launch from Default Activity to any of the other options. Using Specified Activity with one of your activities is a suitable approach.

This works with Android Studio 2.2.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM