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.
Related
I come up with a strange problem while trying to set "SignUpActivity" as my starter activity. I tried different ways but either I am getting an error or "mainActivity" is popping up as a starter activity.
My "AndroidManifest.xml" file has the following code.
<activity
android:name=".SignUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
the above code gives me the error as shown in image
As the error states activity must be exported or contain an intent-filter
so, I did
<activity
android:name=".MainActivity"
android:exported="true"/>
and also tried adding intent-filter to activity. Of course, these methods make error go away but my app starts with MainActivity, not with SignUpActivity. What should I do to slove this issue?
Your AndroidManifest.xml is set correctly, check your run/debug configuration is set to 'App', not 'MainActvity'
If the 'App' configuration is missing - you will need to add it by first selecting 'Edit Confurations'
There are similar posts about this error msg.
Check the run configuration , probably you need to edit the app configuration and choose it to run.
As guided by #Eric I selected an option "app" from the run configuration which solved my problem. Previously, somehow it was set to MainActivity which was causing the issue. I have attached an image to demonstrate the solution for future readers.
I want to make my Android application invisible and work through a background task.
This part should work like these two apps, if anyone knows them:
https://www.keeperschildsafety.net/
https://www2.mspy.com/
I already found examples for making the app icon invisible, but I want to go one step further.
This is the site I found that on:
https://readyandroid.wordpress.com/hideunhide-app-icon-programmatically-android/
I also found some explanations that I should delete the <intent-filter>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
But then I am not able to start my application.
On all other sites I read that this is not possible, but the two examples shown at the top prove that it is actually possible somehow.
I want to start my application once, then hide it and unhide it later.
I already know how to trigger the unhide. The only part that I need is the hiding and unhiding itself.
You need to remove the following line from your AndroidManifest.xml:
<category android:name="android.intent.category.LAUNCHER"/>
This will remove the application from the default launcher. However, you also need to add the following line such that your BroadcastReceiver is not completely ignored:
<category android:name="android.intent.category.DEFAULT"/>
You should NOT remove the line below - it is used to specify which Activity should launch first when your app is opened:
<action android:name="android.intent.action.MAIN"/>
also try this
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
in your AndroidManifest.xml's activity declaration.
I'am using Android Studio and I have developed an Home Application by adding
<activity
android:windowSoftInputMode="stateAlwaysHidden"
android:screenOrientation="landscape"
android:launchMode="singleInstance"
android:stateNotNeeded="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/>
</intent-filter>
</activity>
This is working and I am testing my application with run button no problem.
But after run another app from Android Studio the home application stop appearing home button selection screen.(not everytime). This is how I solve my problem
I create another application
Move files and codes to new created project.
Then my code is working with different name
This looks like a bug, I dont know what is that. Is there a way to clear cache data or another simple way to solve the problem or any suggestion?
You most likely have a different launcher set as default launcher.
In the settings of your device you should be able to set the default launcher.
Go to applications and look for your current launcher. Clear the default launcher.
If you cleared the default launcher and correctly installed your launcher, it should now ask every time which launcher to launch when you hit the home button.
Tip: Try it out on different devices and emulators!
My self-developed android app create 7 items on Device with the same name, but in Settings -> Applications -> Manage Applications there is only one item. All classes of my app have the same package. Can anyone explain for me why?
Thanks you so much.
I understand that your problem is your getting 7 app with same names in the device when your installing it.
If this is so, then check the activtity tag in manifest file,it should contain only one action.MAIN ( mentioned below) , if you added this all activities the above scenario can happen. To resolve , remove this tag to all activities except main activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Hope it helps.
I have a project in Eclipse with maybe 7 different classes that i open with Intent. The problem is when I install the .apk on my HTC phone I get an icon for every class. How do I make the project so it installs as one app only? /Johan Andersson
Exactly, as mreichelt said you have to remove this lines from each class declared on your Manifest except from the one you want to be the main Activity :D
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you only want one activity to be started from the launcher, just remove the intent filters for all other activities than your wanted one in your manifest. Read more here: http://developer.android.com/guide/topics/fundamentals.html#ifilters