handle my website URLs in my app - android

i want to handle my website urls in my android app
for example :
when user in any app click on http://www.example.com/username
my app open and show username information
i use this code for open my app when click on http://www.example.com , but google chrome started :(
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="www.example.com" android:scheme="http"></data>
</intent-filter>
</activity>

You have to add android.intent.action.VIEW and android.intent.category.DEFAULT to the activity's 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:host="www.example.com" android:scheme="http"/>
</intent-filter>
For more information
https://developer.android.com/training/app-links/deep-linking.html#adding-filters

Related

Want to listed my app on android app chooser dialog when user click on any link from different app

I want to listed my app in app chooser dialog (like google, Mozilla are shown in chooser dialog when we click on any link) and it was perfectly work but when i click in any link from youtube it does not show my app in Android chooser dialog.
My manifest file code is :-
<activity
android:name=".mvp.BroswerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="stateAlwaysHidden|stateHidden"
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="developer.android.com"/>
<data android:scheme="http" android:host="*"/>
<data android:scheme="https" android:host="*"/>
</intent-filter>
</activity>
It is working when we click on any other site but in case of youtube is not working.
I have also try to add the sharing intent in my code but there is no luck to solve this.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
Please suggest what can i do to solve this.
Thanks in advance.
YouTube sends a text/plain intent with ACTION_SHARE, unless you are talking about sharing a video. So it is obvious that it won't show up any ACTION_VIEW intent.

Unable to open deeplink through gmail app

I recieve a link on gmail and I want to open my application whenever we click on that link.
If I click on that link, it opens in the website(not in app), but if I copy that link and open it in the browser it gives me an option to choose the application.
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="agora-frontend.herokuapp.com"
android:scheme="https" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="agora-frontend.herokuapp.com"
android:scheme="http" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="agora-frontend.herokuapp.com"
android:scheme="app" />
</intent-filter>
The link I am trying to open is
https://agora-frontend.herokuapp.com/vote/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxx
I want to open my app whenever we click on that link through gmail.

I'm trying to open my app on a specific page using deeplinking but it keeps opening the start page

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="deeplinkingtest"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".resetresponse">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="https"
android:host="callum.pixelpin.co.uk"
android:pathPrefix="/ResetRequest" />
<data android:scheme="http"
android:host="pixelpin.co.uk"
android:pathPrefix="/SignIn/ResetRequest" />
<data android:scheme="deeplinkingtest"
android:host="resetresponse"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I think it may have to do with the scheme, host and pathPrefix not being correct.
The URL in which the app is checking is as follows:
https://login.pixelpin.co.uk/SignIn/ResetResponse.aspx
Full URL:
https://login.pixelpin.co.uk/SignIn/ResetResponse.aspx?code=OAWIBGOAWO893745OBFAIN&user=4389246
Deeplink class set Like below code and must be remove other All scheme .
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="your scheme" />
</intent-filter>
Include the BROWSABLE category. The BROWSABLE category is required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app. The DEFAULT category is optional, but recommended. Without this category, the activity can be started only with an explicit intent, using your app component name.

Path pattern for intent-filter

I want to launch Android application on clicking URL (may be in e-mail or SMS).
How to write different path patterns for these two URL?
http://www.hostname.com/folder1/file.ext
http://www.hostname.com/folder1/folder2/file.ext
I want to launch my activity only from the first URL, not the second one. Currently I am using this intent-filter but it's launching my app with both URL.
<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.hostname.com"
android:pathPattern=".*\\/folder1/*"
android:scheme="http" />
</intent-filter>
Try below code
<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.hostname.com"
android:pathPrefix="/folder1"
android:scheme="http" />
</intent-filter>

Android - url scheme does not work and application does not open

I want to run my app from a custom url.
I added the following to the AndroidManifest:
<activity android:name=".app.RunFromUrlActivity"
android:launchMode="singleInstance">
<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="myapp"/>
</intent-filter>
</activity>
However, when i try to go to myapp://data the browser simply searches fot that string instead of running my Activity.
What am i doing wrong?
Try something like this for "data":
<data
android:host="com.yourpackage.yourotherstuff.TheActivity"
android:scheme="yourscheme" />
Here's one that works for my app:
<activity android:name=".BrowserActivity" >
<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="com.mypackage.otherstuff.BrowserActivity"
android:scheme="myapp" />
</intent-filter>
</activity>
This makes my activity accessible via myapp://com.mypackage.otherstuff.BrowserActivity.

Categories

Resources