Deep Linking Android first opens the launcher activity (not the deeply linked activity )
Asked Answered
A

2

7

Deep Linking Android first opens the launcher activity (not the deeply linked activity ) then the deeply linked activity as declared in Manifest file.I have followed all the steps mentioned here .

viz. Manifest contains

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_title_viewgizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="/gizmos" />
        <!-- note that the leading "/" is required for pathPrefix-->
        <!-- Accepts URIs that begin with "example://gizmos”
        <data android:scheme="example"
              android:host="gizmos" />
        -->
    </intent-filter>
</activity>

and Deeply Linked activity contains

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
}

and some other activity specific code.

Actinism answered 7/4, 2015 at 20:7 Comment(1)
Did you find the reason why this was happening?Speak
S
0

I had this same problem and in my case it was simply a copy and pasting issue. make sure your deep links intent filters ONLY exist under the right activity in the manifest. if you have 2 identical filters under 2 different activities, it will open the first one (logically your main activity would be your first one)

Sling answered 7/5, 2015 at 18:19 Comment(0)
J
0

Just remove android:label="@string/filter_title_viewgizmos" from intent filter. Your code will start working.

Thanks.

Jenniejennifer answered 5/11, 2015 at 12:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.