Android activity-alias multi-entry configuration, android entry activity
In the past, some applications used to generate two icons on the desktop. Some of these two icons are the portals of the same Activity and others are the portals of another Activity, how can this effect be achieved? When viewing the Android native javasclock program, you can see the implementation of this function, using activity-alias:
1. Syntax format
<activity-alias android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:permission="string" android:targetActivity="string" > . . .</activity-alias>
2. DeskClock applications
From the following configuration, we can see that this is the two portals of the same activity (Clock), and the two portals have the same name icon. What is the significance of this operation? You can see that activity-alias marks a category named android. intent. category. category _dock. This triggers the alias portal only when the android device is plugged in to the desktop Dock base.
<activity android:name="DeskClock" android:label="@string/app_label" android:theme="@style/DeskClock" android:icon="@mipmap/ic_launcher_alarmclock" android:launchMode="singleTask" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter></activity><activity-alias android:name="DockClock" android:targetActivity="DeskClock" android:label="@string/app_label" android:theme="@style/DeskClock" android:icon="@mipmap/ic_launcher_alarmclock" android:launchMode="singleTask" android:enabled="@bool/config_dockAppEnabled" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DESK_DOCK" /> </intent-filter></activity-alias>
Activity-alias determines the activity connected to the portal by specifying targetActivity, change a different label (ClockAlias) and icon (chrysanthemum) for the program, and replace the category of the Dock base, as shown in the lower code configuration.
<activity-alias android:name="DockClock" android:targetActivity="DeskClock" android:label="@string/app_second_label" android:theme="@style/DeskClock" android:icon="@mipmap/entrance" android:launchMode="singleTask" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter></activity-alias>
After the configuration is modified, the dual portal icon on the android device can be implemented. You can click the two icons to enter the javasclock program. The specific effect is shown in.
Reprinted please indicate the source: http://blog.csdn.net/l2show/article/details/46828391