The launcher displays a label and icon for any recently resumed tasks. If your app package has multiple apps as separate launcher activities, the launcher won’t know which label and icon to show for non-launcher activities. Non-launcher Activities might be activities launched from a Tile or a notification. This may cause your app to not show up in the Recents list in the launcher, or show up incorrectly.
Label all activities
Ensure that your activities, including non-launcher activities, are properly labelled in your manifest file, as shown in the following steps.
- For every activity in your AndroidManifest.xml, determine which launcher activity it belongs to.
- Copy and paste the icon, roundIcon, and label from the parent launcher activity into each associated non-launcher activity.
For activities that are shared among multiple launcher activities, decide which icon and label to display that represents all of them.
To use RecentTasks for the Recents section in the launcher, activate
debug mode in the Developer Preview Wear launcher. Ensure that your
taskAffinity elements are correctly defined in your
AndroidManifest.xml and that you
manage your tasks and back stack consistently.
Keep the following considerations in mind as you assign tasks:
- Choose a unique
taskAffinityname for each task in your app. You can consider each launcher activity and its children as one task. Assign that
taskAffinityto every related activity in your manifest file.
- Avoid calling
- Avoid creating trampoline activities, which are activities that only launch other activities. Create splash screens using the SplashScreen API.
android:noHistory="true"flags when you don’t want your activity to show up in the Recents section.
- Determine the best launch mode for your activities and develop with that in mind.
Use Debug Mode
You can swap out the standard launcher with a debug version that shows you the latest RecentTasks on the system. The debug launcher can help identify fixes you need to make so that your app works with RecentTasks as expected.
Activate the RecentTasks debug launcher with this adb command:
adb root && sleep 5 && adb shell am broadcast -a 'com.google.android.gms.phenotype.FLAG_OVERRIDE' --es package "wear_sysui#com.google.android.wearable.sysui" --es user "\*" --esa flags "45356976" --esa values "true" --esa types "boolean" com.google.android.gms && sleep 15 && adb shell pm enable com.google.android.wearable.sysui/com.google.android.clockwork.sysui.experiences.globallauncher.GlobalLauncherActivityRecentTasks && adb shell pm disable com.google.android.wearable.sysui/com.google.android.clockwork.sysui.experiences.globallauncher.GlobalLauncherActivity
Open the launcher. The launcher should say Recent Tasks at the top instead of Recents. Otherwise, try the command again.
Deactivate debug mode with the following command:
adb root && sleep 5 && adb shell am broadcast -a 'com.google.android.gms.phenotype.FLAG_OVERRIDE' --es package "wear_sysui#com.google.android.wearable.sysui" --es user "\*" --esa flags "45356976" --esa values "false" --esa types "boolean" com.google.android.gms && sleep 15 && adb shell pm disable com.google.android.wearable.sysui/com.google.android.clockwork.sysui.experiences.globallauncher.GlobalLauncherActivityRecentTasks && adb shell pm enable com.google.android.wearable.sysui/com.google.android.clockwork.sysui.experiences.globallauncher.GlobalLauncherActivity
Look out for the following things when debugging:
- If there are double entries in the Recents section for a single app,
check to see if you are using the
- If the wrong icon or label is displayed, ensure that each associated non launcher activity has the same icon, roundIcon, and label as it's parent activity.
- If the system doesn't launch anything after tapping the entry in the launcher, check logcat filtered on “launcher” for errors, as this issue can be caused by a trampoline activity.