Intent filters does not work with activity-alias

0

Android Manifest File:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
    </intent-filter>
</activity>
<activity-alias
    android:targetActivity=".MainActivity"
    android:name="${applicationId}.AliasMainActivity"
    android:label="@string/app_name"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="someapp" android:host="*" />
    </intent-filter>
</activity-alias>

So when I do,

adb shell am start -W -a android.intent.action.VIEW -d "someapp://some_deep_link"

it shows,

Starting: Intent { act=android.intent.action.VIEW dat=someapp://some_deep_link }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=someapp://some_deep_link flg=0x10000000 }

But when I move the intent filter from activity-alias to normal activity it starts working.

Also it's a react-native app.

FAQ. Why do you need activity-alias?

I don't know myself, as the code was already there. activity-alias is used for opening deep linking through notification. If you guys thing it is not needed it is not needed. But I need the reason as well.

Bonus: if you know why activity-alias is important/needed in this case.

android
react-native
android-activity
android-manifest

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0