App name in launcher is taken from main Activity label insead of from intent label

北战南征 提交于 2020-06-09 05:26:08

问题


I've set intent filter label as per and per and per official docs:

The icon and label that are set in a component's are shown to the user whenever that component is presented as an option to fulfill an intent. By default, this icon is inherited from whichever icon is declared for the parent component (either the or element), but you might want to change the icon for an intent filter if it provides a unique action that you'd like to better indicate in the chooser dialog. For more information, see Allow Other Apps to Start Your Activity.

So my app's manifest looks like:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    <application
        android:label="@string/app_name">
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main">
            <intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Setting intent filter's label does NOT set @string/app_name in launcher in my case. The string @string/title_activity_main is used instead.

I think it may be related to my setting compileSdkVersion 29 because when I run my app on emulator with Android 5.1 the same problem occurs.

Further more when I'm uninstalling the app then a new popup layout is shown - with string:

[content of @string/title_activity_main] is part of the following app [content of @string/app_name]. Do you want to uninstall this app?

来源:https://stackoverflow.com/questions/61328477/app-name-in-launcher-is-taken-from-main-activity-label-insead-of-from-intent-lab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!