Deeplink on click opens intent chooser in android - android

I have implemented deeplinking in one for my activities. But when the link is clicked, an Intent chooser opens asking whether to open from the app or from the browser. How to open from app directly?
Also, when the app is not installed, it does not take to playstore. It opens in the browser.
Below is my code in the manifest :
<activity android:name=".activities.VideoNewsDetailActivity"
android:theme="#style/AppThemeActivity"
android:configChanges="orientation|screenSize"
>
<!-- Add this new section to your Activity -->
<intent-filter android:label="#string/videoNewsDetail">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Handle urls starting with "http://www.example.com/products" -->
<data android:scheme="http"
android:host="ddnews.apprikart.in"
android:pathPrefix="/videos" />
<!-- Handle local urls starting with "example://products" -->
<data android:scheme="ddnews.apprikart"
android:host="videos" />
</intent-filter>
</activity>

This is how intent filter work. If more than 1 app can handle your intent, it will show an intent chooser. It's up to the user whether they want to open the link in your app or browser.
Your server should handle the playstore redirection part. For example your deeplink url is http://www.example.com/page/1. Now when the app is not installed the server can check if the url is called from a browser, then it should redirect the browser to the playstore's app url.

#Eric B. is right.
Even if you want only your app can open that link then you need to use custom scheme in intent-filter, like:
android:scheme="ddnews"
And need to build link like, ddnews://domain.com/dir/page.html

Related

Android deeplink - don't show intent chooser popup, force open app

I want to open my app from browser, when user opens any link that my app handles. So I'm using deeplinking. Here's my code in manifest file.
<activity
android:name=".ColorCaptureActivity"
android:label="#string/title_activity_color_capture"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter android:label="DeepLink">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http"
android:host="www.somelink.com"/>
</intent-filter>
</activity>
Everything fine, but when I click on the link, android shows intent chooser, where displayed all apps that can handle this intent. I understand it's the default behaviour, but is there a way to not show the chooser popup and open my app directly?
Try implementing App Links to set your application as the default handler for the links.
Refer: https://developer.android.com/training/app-links#app-links-vs-deep-links

open Url in android in web browser application

I am working on a Web browser. The web browser is working, but I need help in the part where my Application catches Android system's url when clicked (http,https etc) and open my web browser application
Like any other browser chrome ,firefox etc, how these app open the default app choose menu?
Reading about these I learn about <intent-filter> is used
Can someone help me with what to be added to Manifest file and to my activity so that my Application catches url?
Try adding CATEGORY_BROWSABLE to your activity that can handle URLs.
Like this:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<!--This makes activity an option for the default action (center press) to perform
on a piece of data. -->
<category android:name="android.intent.category.DEFAULT" />
<!-- Activities that can be safely invoked from a browser must support this category. -->
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http" />
<data
android:scheme="https" />
</intent-filter>

Open Activity from url is not working android

Hello friends i want to open my application when particular type of url is being called in browser (Predefined format)
following is rout on server
Redirect::to('intent://com.customlymade.activit/#Intent;scheme=customlymade;package=com.customlymade.activity;end');
and following is the intent filter i am using in my manifest file
<intent-filter>
<data
android:host="com.customlymade.activity"
android:scheme="customlymade" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
But Nothing is working Please help.
I guess, that the redirect is executed automatically. Chrome in android has a security feature, that starting an activity can only be done after a user action (like clicking on a link). See chapter "See also" at https://developer.chrome.com/multidevice/android/intents
And Chrome doesn’t launch an external app for a given Intent URI in the following cases.
When the Intent URI is redirected from a typed in URL.
When the Intent URI is initiated without user gesture.

invoking an intent using html link

I am trying to implement a new feature for my android application.
scenario :
when some event occurs, the camera sends an email to my (Gmail) account.
on opening the mail, it will have a link (html).
when user clicks on that link, it should launch my application Home activity.
I need to understand :
how to create that html link.
how can i make the link to launch my application Home activity.
kindly help me to understand what all things i need to do in my application.
I used "Blackbelt's" user comment and i was able to get the intent html link working.
But my problem is : i want to use a custom scheme "mobile" instead of "http"
I am using Gmail to use the link. But when i send using custom scheme. Gmail doesnt recogonise as hyperlink. So i cannot click on the link.
Please help me how to use a custom scheme. with gmail
you need to register an intent-filter for your Activity on the AndroidManifest.xml file, defining a custom url. . E.g.
<activity android:name="path.to.YourActivity" >
<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="https"
android:host="it.is.my.app" />
</intent-filter>
</activity>
So if you press on a link like https://it.is.my.app, you should be prompted with the android intent chooser, with your app

Android: intercepting an intent ends with my Activity attached to the opener app

I've developed an Android Application. I've defined an intent-filter so that my app is used to view some links:
<intent-filter>
<data
android:host="my_url.com"
android:pathPrefix="/some_prefix/"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
When I open one link like "my_url.com/some_prefix", my app appears on the selector and, if chosen, its open to display the link.
However, my Activity is opened attached to the application that lauched it. Lets say, for example, that the link is displayed in a WhatsApp message, after opening the link my app is displayed. If I try to open WhatsApp again, my Activity is displayed, instead of WhatsApp.
How can I detach my Application from the Application that called it?
Your activity is being opened in the current 'task', which is the WhatsApp task.
What you are wanting is for your app to be opened in a new task.
There is a flag you can set on your activity in the manifest:
android:launchMode="singleTask"
This will tell android to open your activity in another task.
Read more about tasks here

Categories

Resources