-1

I have an application which I simply want to run but it should not have launcher Icon.

I have deleted this tag

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

But then Android studio starts to give error that

Could not identify launch activity: Default Activity not found Error while Launching activity

then I switched the run configuration as the following : I am using android studio 2.0 preview 6

What I want :

I just want that My application start running once I run it from the android studio , but it must not have launcher icon . SO that user should not be able to launch it by himself.

Note:

I do know that it is not legal we should have activity so that user can se it , use it and change something if he wants. But that is not the case in my app as the user want himself to hide its launcher so that no body knows about app. So do not worry about such case. :)

Allay Khalil
  • 624
  • 1
  • 10
  • 26

1 Answers1

3

I have an application which I simply want to run but it should not have launcher Icon.

Then your app will never run.

running service or broadcast receiver

Your app, once installed, is in a stopped state. None of your code will run until something uses an explicit Intent to start one of your components. Normally, that is the launcher icon. Other possibilities include if the user sets up an app widget, or if your app is a plugin for some other app (and that other app uses an explicit Intent to start one of your components). Outside of those scenarios, your app will never run. This is to help prevent malware.

the user want himself to hide its launcher so that no body knows about app

You will still need a launcher icon. However, when the user runs your app, you can use PackageManager and setComponentEnabledSetting() to disable that activity, so it will no longer show up in the launcher.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • can you please redefine this part : you can use PackageManager and setComponentEnabledSetting() to disable that activity, so it will no longer show up in the launcher. – Allay Khalil Jan 22 '16 at 13:34