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 :)
Related
Here is an exemple of the link:
https://somelink.someotherlink.ws/path1/path2/path3/path4/dynamic_path1/dynamic_path2
<activity
android:name=".activite.Activity"
android:exported="true">
<tools:validation testUrl="https://somelink.someotherlink.ws/path1/path2/path3/path4/..*/..*/"/>
<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="somelink.someotherlink.ws"
android:pathPattern="/path1/path2/path3/path4/..*/..*/" />
</intent-filter>
</activity>
So here when I run the test from the android studio tool the url is resolving my activity and also launching it.
This also is working when clicking this url link from other apps
But only when it comes to web browser (Entering the link in the search bar and click enter or any other programatic redirection) the redirection not going to my app.
Ex:
https://somelink.someotherlink.ws/path1/path2/path3/path4/dynamic_path1/dynamic_path2
this is not getting resolved in anyway
I've also tried to use the two dot enforcement and single dot enforcement but getting same result.
Thanks for any help.
i just need to open the application when i click on button of html page if html page are open in android phone browser.
sorry for my English.
please suggest.
thanks in advance
you can set intent-filter of Main-activity of your application as follow to open this application from browser.
<activity
android:name="activity_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:host="example.com"
android:scheme="http" />
<data
android:host="www.example.com"
android:scheme="http" />
</intent-filter>
</activity>
Edit:
If you have written <intent-filter> of your activity as mentioned above then on you can open your app on html button click as follow.
On Click of html page button call a url http://www.example.com
example:
<input type=button onClick="parent.location='http://www.example.com'" value='Open App'>
An installed application can be launched from deep links.
See Deep Linking
I am trying to create an URL scheme for my Android application but when i enter the link in the browser it opens the link not the app. So far my code looks like this. The link is formed like this http://myhost.com .
<activity android:name=".activities.OpenSchemeActivity"
android:label="#string/activity_open_scheme"
android:screenOrientation="portrait"
android:exported="true"
android:launchMode="singleTask">
<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="myhost.com"/>
</intent-filter>
</activity>
Does anyone have any idea why is not working?
Sorry to say that it will NOT work directly from the browser's address bar. No way. Only further server redirects or link clicks can lead you to an app picker. As far as I know, browser doesn't handle URL schemes being typed into address bar as something that could require an Intent call.
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)
I have implemented the Android Custom URl scheme and it works fine when I send the link that I want to open as a mail and then click on it.
It does not work when I type the same address in the address bar of my Mobile Browser which in turn gives a page not found error.
This is my intent-filter for the same -
<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="myappname.com"/>
</intent-filter>
Is there something else that I need to specify for making http://myappname.com open if I type it in a web browser. Is it the case that some phones/browsers do not support such behavior? Or is this not possible at all?
Any help will be appreciated.
Thank You in advance.