...">

Dual Launch Application

I have an application that contains two actions with

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

in the manifest. I did this so that the application had 2 separate entries. It functions correctly with respect to the application as it is.

My question comes during installation. After installing the application with one active MAIN / LAUNCHER action, there is an open button on the last page that will launch the application that has just been installed. In my application, this button is open. I assume this is because he does not know which of the two actions I would like to start if the open button was pressed. Is there anything I can install in the manifest (or elsewhere) to indicate what activity I would like to open the open button at the end of the installation process? I think there must be something that I can install, because when I install the application via adb with eclipse, it launches one of two actions, and, fortunately, this is actually the one I would like to run .

+6
source share
3 answers

This question:

After downloading the application with two Launcher components from the Marketplace, clicking the "Open" button will crash

Helped me make it work as I wanted. The key was added:

  <activity-alias android:name="com.android.internal.app.ResolverActivity" android:targetActivity=".Main" android:exported="true"> </activity-alias> 

for the manifest and β€œ.Main” changes for the link to the activity that you want to start using the β€œopen” button at the end of the installation.

Please note that the alias activity tag must be declared after the activity tag you are accessing (in xml).

+7
source

In Android docs, it is highly recommended that when you run several actions on the home screen, each of them starts as part of its own task. See this article for more information.

In addition, each task will have a separate taskAffinity value. I believe that a task that is configured for the same proximity as the application package is the one that will be selected by the installer as starting.

+1
source

I suggest you have 1 activity that reads preferences and decides to continue the current activity or open another action.

If you do not want to start a new action, try to inflate the corresponding fragment.

0
source

Source: https://habr.com/ru/post/905767/


All Articles