Deep Linking from browser not working Android
Asked Answered
C

3

9

Deep Linking not working in android. I have pasted my manifest code here. When I tested, it goes to the website and not opening my activity in my app. Can someone help me fix this?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.clinicloud.app" >

    <application
        android:name=".MainApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar" >
            <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:host="www.XXXX.com"
                    android:pathPrefix="/xyz"
                    android:scheme="http"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".OnboardingActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ProfileViewActivity"
            android:label="@string/title_activity_profile_view"
            android:theme="@style/AppTheme.NoActionBar" >
        </activity>
    </application>

</manifest>

UPDATE:

adb shell am start -W -a android.intent.action.VIEW -d "http://www.clinicloud.com/xyz" com.clinicloud.app

Testing with adb opens the app but just with browser its not opening the app.

Cochise answered 10/11, 2015 at 4:0 Comment(9)
What is the link you are clicking to get to your application?Tawnyatawsha
@user5001783 where is your source code post here ...so that we can help you.Ruttger
I actually want it like this. If the user types in clinicloud://, the user should be navigated to the app. But I read in other questions that google changed deep linking that it will ignore non-HTTP/s calls. So now I am trying like "clinicloud.com/xyz"Cochise
Your code seems correct. IF this is the exact link you are writing in the anchor tag, i would suggest to prepend www with itTawnyatawsha
I am using the url as http : // www . clinicloud.com/xyz. sorry I included spaces because if I dont it displays as the previous one. I think Source code is secondary thats needed only for the processing after the activity is open, right?. Because as of now I did not put in any logic in the activity source code to intercept this req. My aim is to launch the app first.Cochise
First test your app by using ADB command. The command below tries to view a target app activity that is associated with the specified URI. $ adb shell am start -W -a android.intent.action.VIEW -d "clinicloud://xyz" com.clinicloud.appVaruna
I already tested with ABD command. It opens the url in browser and activity is not opened. @CC-UBUNTU3:~/Android/Sdk/platform-tools$ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "clinicloud.com/xyz" Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=clinicloud.com... } Warning: Activity not started, its current task has been brought to the frontCochise
Did you tested using the QR feature that Google provides in - developers.google.com/app-indexing/android/test ? Using the following deep link: [android-app://com.clinicloud.app/http/www.clinicloud.com/xyz/]Dornick
I'm having the same problem, any luck on answers?Rangy
T
4

It's so annoying to test deep link through adb as the Android Developer team suggested. We won't get the gist of the problem I think. We want a straight forward method like paste a link to the browser in the same device which also installed the app already, hit GO, then the app comes up. But unfortunately, it won't work though.

Reason:

It's not a pure link, when you go to URL search of the browser it actually does a different URL, e.g: 'https://www.google.com/search?....'

Solution: Open a pure link

  1. As @Parag Chauhan suggested, using another app to open a link, sure it is a definitely working solution because it's a pure link. However, this is not practical as expected.

  2. Alternatively,

    2.1. You can build your own simple web page (simple file *.html) with a link, then click it to open a pure link. Here is an example of the web page:

<html>
    <h1>
        <a id="deeplink" href="ss.wohui.learn://subscribed">Deep Link</a>
    </h1>
</html>

2.2. Replace ss.wohui.learn://subscribed with what your deep link is.

2.3. Download the file to your device.

2.4. Open it by a browser.

2.5. Click on the Deep Link.

2.6. The app will start.

Thetes answered 13/4, 2021 at 4:41 Comment(0)
I
3

This will only work if server has /.well-known/assetlinks.json properly defined in the root domain on the server.

So you need to create a json file and define there package name and SHA256. Then guys from backend should put this json file into root domain on the server.

The content of the file looks like:

[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "com.blablabla.staging",
      "sha256_cert_fingerprints": ["XXXXXXXXXXXXXXXXXXX"]
    }
  }
]

You can split it for different environments: staging, beta, prod etc.

I tested in default browser of Samsung “Internet” and it fired the deeplink!

Intoxicate answered 21/7, 2022 at 10:2 Comment(0)
R
1

Add this code in Manifest.xml

<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:host="www.clinicloud.com"
        android:path="/xyz"
        android:scheme="http" />
</intent-filter>

For test create another project and run below code

Intent i = new Intent(
    Intent.ACTION_VIEW , Uri.parse("http://www.clinicloud.com/xyz")
);
startActivity(i);

You can also pass parameter in link. For more info, see my blog post Make a link in the Android browser start up my app?

Regulus answered 10/11, 2015 at 5:14 Comment(2)
This works from a different project. But my requirement is from a browser. when this URI is typed from the browser, it should work. It doesnt work from the browser.Cochise
it should work do one think share "clinicloud.com/xyz" in email or whats app and click on it ,it will show popup with chooser and your app will show in popupRegulus

© 2022 - 2024 — McMap. All rights reserved.