I writed a simple Android application and added a intent filter like this:
<intent-filter>
<data android:scheme="http" android:host="www.somesite.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Okay. Now, when I click by link from another application (like GMail) i see a dialog: choose application for run: MyApp or Browser.
But when I type this URL in browser's address bar it just open a site.
How can set up my app like a Google Play, Google+? (When I type a http://play.google.com/ - i see a dialog Google Play App or Browser)
Related
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
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>
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();
The following works fine:
I click on the link www.mycompany.com in an email and it starts my app:
<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.mycompany.com/download" android:scheme="http"/>
</intent-filter>
However, what I want to work is as below but it's not working:
I want to be able to restrict it to the link www.mycompany.com/download:
<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.mycompany.com/download" android:scheme="http" />
</intent-filter>
Why the distinction? I don't want to block my entire website with the app. I just want that specific domain to redirect to the app. How do I do that?
What you've shown is not a subdomain. That is,
www.mycompany.com/download
is not a subdomain of
www.mycompany.com
But you could use a subdomain to address this issue by setting up something like
download.mycompany.com
and have it map to www.mycompany.com/download. (Most servers allow you to set up subdomains like that.) You can then modify the intent filter accordingly.
EDIT
To support what you're trying to do without setting up a subdomain, you can do the following:
<data
android:host="www.mycompany.com"
android:scheme="http"
android:pathPrefix="download"
/>
I would suggest you to try latest feature made available by Google and that is App-indexing to show your app even when user search about your website on Google.
You need to go through 2 steps:
1 Sign Up for this feature here
2 Update your app as well as sitemap of your website as mentioned here
For further reference you can go through this documentation
Screenshot :
I'm developing an android app.... and I want to open my app when someone types the url in browser.. I'm able to get the "Complete Action Using.." and My app also shows there ONLY when I click the bookmark to the web link.. However if I type the URL in browser it simply loads up the website.. but I want to redirect it to my app.
Here is my code in Manifest file.
<intent-filter>
<data android:scheme="http" android:host="SOME_URL.SOMETHING"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
*SOME_URL.SOMETHING is the name of website to load.
Thanks in Advance :)