Open Activity from url is not working android - 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.

Related

android deeplink, force open externally

I am developing an android app which accepts deeplink. For example consider this one:
<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="returnapp" android:scheme="testscheme" />
</intent-filter>
So if we call the url testscheme://returnapp/?status=1 then app should be opened.
In Google Chrome it opens up and everything goes right but in firefox, the app gets opened as child of browser task (which has the link to my app). But I want it to be opened independently.
So is there something to add to manifest to force this attribute or I should add some keyword in my HTML href?
UPDATE
I think I should make a change in the link showing in webpage in firefox. Currently I am using this link:
<h1>test</h1>
Something like target="_system" to tell firefox to open this link externally.
The browsers itself need to support and implment the browsability. The browsers have to find other activities supporting android.intent.category.BROWSABLE when opening a web-page.
So as you say, Firefox is not supported for opening app directly, however there is a solution you can try is to add android:autoVerify="true" in any one of the web URL intent filters in your app manifest that include the android.intent.action.VIEW intent action and android.intent.category.BROWSABLE intent category, as shown in the following manifest code snippet:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="returnapp" android:scheme="testscheme" />
</intent-filter>
Even though I'm still not sure this gonna work because of android:autoVerify="true" is for appLink not for deepLink

Deeplink on click opens intent chooser in 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

Intent Filter passing data through url and reading into activity

In my app, I need to open one page from out side app, through link which is in email.
In my app when some one will create post from our website then we are sending email with url.
When user will click on url/link then it will open respective page in the app.
I need to pass some id and other value to the activity when it launch.
Example:
we are sending following link through email when some one create post on website.
https://www.example.com/lt-url-redirector.php?user_guid=4074395&notify_entity_id=7221752&notification_type=22&notify_id=56933b6219b05172&baseurl=https://www.example.com/groups/calendar/aggregation/mlt
After clicking on above link it goes to mobile browser where "Open in App" button is there.
After taping on this button it gives:
window.location.href = 'abcdef:/?user_guid=4074395&notify_entity_id=7221752&notification_type=22&notify_id=56933b6219b05172&baseurl=https://www.example.com/groups/calendar/aggregation/mlt';
I want to pass notify_entity_id, notification_type, notify_id etc to the activity when it launch.
Android Manifest code :
<intent-filter>
<data android:scheme="abcdef" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Those are query parameters, and there are a variety of methods on Uri for retrieving those values, such as getQueryParameters(). To get the Uri, call getIntent().getData() from some likely spot, such as onCreate() of your activity.

How to open android application when an URL is clicked in the browser

I have to open my android application, when user clicks on a link that has my domain name. For example, lets say my domain is abc.com and i have posted this link on my Facebook page. When one of my friend(who has my application installed in his device) clicks on the link(in the device's browser), i should be able to open my website in a webview inside my application.
I am not sure how to get this work, but will intent-filters work? If so, can someone give me a piece of code to start with?
You have to define a custom Intent Filter in the activity that should be launched when the url is clicked.
Let say that you want to launch the FirstActivity when a user click a http://www.example.com/ link on a web page.
Add this to your activity in the Manifest :
<activity android:name=".FirstActivity"
android:label="FirstActivity">
<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.example.com" android:scheme="http"></data>
</intent-filter>
</activity>
When the user will click a HTML link to http://www.example.com/, the system will prompt either to use the browser or your app.
You can achieve this by using URI schemes (link e.g. myscheme://open/chat), add into your manifest this filter into e.g. main activity section (set your scheme name):
<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="YOUR_SCHEME_NAME" />
</intent-filter>
In your activity where you've set filter, you can get URI by calling this (in onCreate):
Uri intentUri = getIntent().getData();

Android - open url in my app when my app is already opened

I'm trying to open a specific url with my app instead of browser. I have it working correctly except if my app is already open, the url doesn't open to the page specified.
My manifest file is as follows:
<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="myapp"/>
<data android:scheme="http"/>
</intent-filter>
And I'm getting the intent data as:
Intent intent = getIntent();
Uri data = intent.getData();
But getIntent() returns the intent that started my activity, what if my url click didn't start my activity and the activity had already been created, how do I get the intent for whatever is resuming the app (so my specific path link). Is that even possible???
I am targeting Android 4.2.2
how do I get the intent for whatever is resuming the app (so my specific path link)
Override onNewIntent() and use the Intent passed into it.

Categories

Resources