How to use deepLink in Android - android

PLEASE HELP MEEEE
In my application i want use DeepLink and for this i write below code.
But when run application not suggest my application and just show in Chrome browser !
My Url : sosapp://sosapp/hashcode/ghfhgfhgf?
My codes :
<activity
android:name=".Activity.LandingActivity"
android:screenOrientation="sensorPortrait" />
<activity
android:name=".Activity.MainActivity"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sosapp" android:host="sosapp"/>
</intent-filter>
</activity>
How can i fix it and when click on this Url from mobile, suggest my app ?

I have tried use your link in my Activity and works fine.
my Activity Manifest:
<activity android:name=".MyActivity">
<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="sosapp"
android:scheme="sosapp" />
</intent-filter>
</activity>
and my intent used to call the activity
val action = Intent()
action.data = Uri.parse("sosapp://sosapp/hashcode/ghfhgfhgf?")
startActivity(action)

Add pathPattern to your data tag like below:
<data
android:host="sosapp"
android:pathPattern="/*"
android:scheme="sosapp" />

Try adding label, it's mandatory for higher versions of android. See example from the docs. They always include a label for intent-filter
<intent-filter android:label="#string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmosā€ -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>

Related

Android IntentFilter Custom Scheme [ONLY custom scheme] not opening the app

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "myscheme://" -->
<data android:scheme="myscheme" />
<data android:pathPattern="/.*"></data>
</intent-filter>
</activity>
I have added the above code in the manifest.xml and am trying to open myscheme from the emulator's browser.
What am I doing wrong?

adding deep linking data to the MainActivity intent-filter removes the icon in the device

I'm trying to add deep linking to my app and when I add:
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
to the intent filter in my MainActivity the icon is not installed in the device after compiling.
Here is the activity part on the manifest:
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="adjustPan"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
</activity>
You need two separate intent-filter.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:scheme="http"
android:host="www.xxx.com"
android:pathPrefix="/app" />
</intent-filter>
Docs say:
When you want to handle multiple kinds of intents, but only in
specific combinations of action, data, and category type, then you
need to create multiple intent filters.
So, you should define multiple intent-filters so that each of which will handle a separate concern.
One for MAIN / LAUNCHER. (Showing icon of your app in the launcher)
One for VIEW / BROWSEABLE.

Create Custom URL protocol in Android

How can I create a custom protocol in Android?
I have tried this code:
<activity android:name=".MyActivity" android:label="#string/app_name">
<!-- open the app when a foo://www.example.com link is clicked -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="foo" />
</intent-filter>
Register this in Manifest file and call in browser like this foo://hello but it not open my app .
I remember having similar problem a while back. Hope my solution will help you solve yours.
Add android:exported="true" and move <data android:scheme="foo" />
on top.
<activity android:name=".MyActivity" android:label="#string/app_name"
android:exported="true">
<!-- open the app when a foo://www.example.com link is clicked -->
<intent-filter>
<data android:scheme="foo" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

My app is opened when clicking on a URL in Android

I have defined an intent filter in order to launch my app from some kinds of URLs. The point is that it is launched for all the kinds of links, and I only want to be launched for a concrete host name. Here is my manifest:
<activity
android:name="com.imin.SplashActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:logo="#drawable/img_action_icon"
android:screenOrientation="portrait"
android:theme="#style/AppTeme.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="imintheapp.com"
android:pathPrefix="/events/get/"
android:scheme="http" />
</intent-filter>
</activity>
I need to open my app ONLY in the following cases: http://imintheapp.com/events/get/xxxxxxxx where xxxxxxxx is an alphanumeric string.
What I am doing wrong?
Regards,
Add this code in Menifest.xml
<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.parag-chauhan.com"
android:path="/test"
android:scheme="http" />
</intent-filter>
For test create another project and run below code
Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse("http://www.parag-chauhan.com/test"));
startActivity(i);
You can also pass parameter in link
for more info
http://paragchauhan2010.blogspot.com/2013/03/make-link-in-android-browser-start-up.html
Try this
<data
android:host="imintheapp.com"
android:path="/events/get/"
android:scheme="http" />
I think you should look at the intent-filter element of your Mainfest file. Specifically, take a look at the documentation for the data sub-element.
Read those docs again.
I also suggest you to read the 2nd ans of this Que.

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