Using Deep link to open app with external link - android

I am trying to make my android app open when the user presses on a link to our website.
I was following this documentation but it is not working for me as it always opens the browser instead of asking if I would like to continue with the browser or the app. What am I doing wrong?
here is my manifest
<activity
android:name=".presentation.MainActivity"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/Theme.LegendaryCollectionsAndroid.NoActionBar"
android:allowTaskReparenting="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data
android:host="www.legendarycollections.net"
android:path="/reset"
android:scheme="https"></data>
</intent-filter>
</activity>

check your website association here.

Related

Browser can't open an app from a browser using deeplink

I'm trying to implement deeplinks in my, so users will be able to open the application from a browser. So, I've added deeplinks in my application in a Manifest.xml. And this code is working from adb, but when I'm trying to open this link in browser, the application does not opens. What can cause this error? I can even can't see an Intent in my code
<activity
android:name=".ui.main.MainActivity"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="http"
android:host="example.com"
android:pathPrefix="/"/>
</intent-filter>
</activity>
Use Firebase deep link ( Hope Help-full )
https://firebase.google.com/docs/dynamic-links

How to launch app on click of url in android

Launch app when click on url if app installed on device. if app not installed on device, open playstore.
<activity android:name=".ui.NewsCardActivity">
<intent-filter>
<data android:scheme="app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
You have to deep link your app, add following lines in activity (Manifiest.xml) which you want to launch
<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="screen" android:scheme="appname"/>
</intent-filter>
in browser when ever you click appname://screen your app activity will be launched,
replace appname and screen as per your requirement
Note if you type this url in browser it will search in google ,for this to work you have to write link in html page
Some text
If not working the add android:exported="true" in activity
<activity
android:name=".activity.MainActivity"
android:exported="true">

Open Android App with custom URL scheme

this questions has been asked in a similar way like a hundred times, though I still cannot find a proper answer to get my app to work the way I want. Maybe this is not possible which would be a valid answer of course.
I have an activity defined as follows in my app:
<activity
android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="MyActivityCustomUrlScheme" />
</intent-filter>
</activity>
When I start my App in the emulator and then open the browser and type a URL like:
MyActivityCustomUrlScheme://mycustomHost.com?someOptions
the only thing happening is that chrome tries googling for it, which is not what I want. If I send myself an SMS with this scheme, the scheme inside is not recognised as such and not clickable :(
I want to do that, because I already have an iOS App in the store, which uses the scheme MyActivityCustomUrlScheme://mycustomHost.com?someOptions and it would be a lot of hazel to change it everywhere, as users get this url send by email or SMS. I'd be really thankful if someone can help me out on this problem.
Try to use definition of host :
<activity android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="MyActivityCustomUrlScheme" android:host="mycustomHost.com" />
</intent-filter>
</activity>

How to avoid multiple open in particular application in android?

I have already opened my android application. I used url scheme, so that my app can be opened from the users email. But if i try to open my application from clicking email link from the web browser, it will open that application in separate window. (Please see my attached screen short picture) .
How to avoid my application to open twice separately?
<activity
android:name="com.mYs3.MainActivity.flash_screen"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="mYs3" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
try this line in your activity block in manifest
android:launchMode="singleTask"

Android intent filter not working to launch activity from browser

I've read a tutorial on how to launch an app from a link on the browser. I've created an activity 'TestLaunch'.
<activity
android:name=".TestMe"
android:label="Test">
<intent-filter>
<data android:scheme="testme.com" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
Then I connected my android phone and clicked 'debug' on Eclipse. The app launched as usual. I openned the browser and typed 'testme.com'. The activity was not started as expected. Is this because the app is not fully installed on the phone or because I am understanding wrongly how the intent filter works?
try this:
<activity
android:name=".TestMe"
android:label="Test">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.testme.com" android:scheme="http"></data>
</intent-filter>
</activity>

Categories

Resources