How to create additional launcher Icon(s) for same android app? - android

I have an application where I need to provide a additional icon acccessible in applications to launch an activity from the same application.
So that when application installs it shows two icons in the applications list, one icon to launch the app is already there, how to have the other icon and then how can I start the required activity from that icon/shortcut.

add this in the manifest file inside the activity tag which you want to show in the launcher
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Related

single app with different launches to configure and run in android

I have a requirement to do an app to function like this.
Its an android application and it should have 2 launching methods.
One is to proceed the function directly when touching the icon.
Another icon should be there to give the setting to the same app to set the setting the settings of the android application.
Basically the app should work like the screen off and lock app in the market.
How can i achieve these 2 things in one app? When i install the app, i need to have two icons, one to do the functionality directly and other to set the settings of the application.
I believe you are trying to have to separate launchers (icons to start apps) in your app, launching two different activities. This is easily achieved within your manifest. Create two activities, say MainActivity and SettingsActivity and then declare them in manifest as launch-able - with different titles:
<activity
android:name=".MainActivity"
android:label="#string/main_activity_title"
android:icon="#drawable/main_icon">
<intent-filter android:label="#string/main_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/settings_activity_title"
android:icon="#drawable/settings_icon">
<intent-filter android:label="#string/settings_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When your app is installed, there will be two icons created: one to start the MainAcivity and another one to start SettingsActivity.

Android Manifest

I found a code on internet for displaying a splash screen before starting an android application. He made some changes in the code which he didn't explain well.
He used Launcher for Splash screen Activity and used Default in main android Activity.
He used Package name with main class name instead of pre-generated code for android:name in action.
Here is the code.
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StartingPoint"
android:label="#string/title_activity_starting_point" >
<intent-filter>
<action android:name="com.alfred.splashscreenwithsound.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
So my question
What is the difference between LAUNCHER & DEFAULT.
Is there any good behind changing the android:name in action to the package name.
when you write LAUNCHER it will launch application with Icon and if you remove it it will not show you the application Icon
"android.intent.category.LAUNCHER" serves as our main entry into the app.
android.intent.category.DEFAULT be set if the Activity should be an option for the default action (center press) to perform on a piece of data.
Refer this
LAUNCHER is your main page DEFAULT is your Activity page when load the app. on device first LAUNCHER will open. Then If you trigger your activity page DEFAULT will open.

How to add a second launcher icon to an app previously published in the Market with only one launcher icon?

I want two launcher icons for two different activities in my application. I have added this to the Manifest file.
<activity ... android:name=".TestActivity01">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity ... android:name=".TestActivity02">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This works fine if you install the app with the two launcher icons since the beginning.
My problem is that I have already published my app in the Market with one icon launcher only. If I just add the intent-filter with the .Main and .Launcher options to another activity it doesn't work when the users update the app. They keep having one icon only. If they uninstall the previous version and then install the new one then they will have the two icons.
Question: is there a way I can force a "clean" upgrade? I don't have problems with loosing information.
Hi first time u have update the application in android market one lancher and second time u have update the next version your application in this application u have check the package u can modify the mainfest file another lanching activity what is the use two lanching icons (user download u r app this time another app download option is it correct ) In android market every updations only compare to package only.

Multiple android.intent.action.MAIN in manifest xml file

I am new to Android development I seen lots of tutorial where they have only android.intent.action.MAIN which is basically a start activity of the application.
But, in the android app demos, I have seen multiple android.intent.action.MAIN statements in mainfest.xml. Can anyone explain why the mainfest.xml has multiple android.intent.action.MAIN statements?
And, in which scenarios we are supposed to have multiple MAINs in manifest.xml?
They're different entry points into the program. For instance, I just created two activities, both of which had the typical intent filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
It turns out that my launcher screen now has two different icons for the same program, one for each different activity. This makes sense, since the MAIN/LAUNCHER intent filter essentially tells android that the activity is the app's starting activity. Nothing in android's intent filter model forces each app to have one and only one starting activity.
LAUNCHER is the category, while MAIN is the action.
MAIN defines an entry point, specifying a way the app can be launched. For example, Consider an App which has 3 activities,
SplashActivity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
EmailActivity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.CATEGORY_APP_EMAIL" />
</intent-filter>
PlayMusicActivity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.CATEGORY_APP_MUSIC" />
</intent-filter>
If I click on the app icon on the home screen i.e launcher, I see Splash Activity.
If I click on a email address from a Messaging app, the system will show me a list of apps that support sending mail including my app(basically it searches for a specific combination of the intent filter provided by all applications) And when I select my app, EmailActivity will be launched.
If I open a file browser and click on an audio file, my app will be listed to open this file, and PlayMusicActivity will be opened.
So, ACTION.MAIN is the different 'enrty' points or the different 'ways' the app can be launched.
CATEGORY will tell what type of launch it can be.

open application on install android

I am making an application but i don't want it to be on the Home Screen as a Launcher icon. It holds Background Service.
Is it possible that when the user install the application it opens the screen automatically so that user could enter the Pin Code or password? But that does not need to be on the launcher icon?
Please Friends Guide
Its possible man.. Just remove intent filter tag under tag activity in the manifest file.
Declare activity as listed below
<activity android:name=".CallIntents"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

Categories

Resources