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

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.

Related

How to open activity using Voice Interaction?

This is one of my activities in my Android Manifest.
<activity
android:name=".voice.VoiceAccountActivity"
android:label="Qnet Balance"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE" />
<data
android:host="qnet.balance"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I've read the Voice Interactions API but every time I say "Open Qnet Balance" it just shows me a bunch of search results from the web. The Browsable and the data qnet.balance I tried to use it as a way to open my app using voice by saying "Open qnet.balance" but that also failed. Anyone have a solution? I'm talking about calling these commands after doing "Ok Google"
Change intent filter tag. And do try to change label to one word it will work.
<activity android:name=".MainActivity" android:label="race">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.VOICE" />
<data
android:host="qnet.balance"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
It opens only launcher activity. I hope this will work

How to use deepLink in 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>

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.

How to have two different intent filters for same activity?

Hi I'm integrating two different apps into my app.One is fitbit and other is pinterest.My problem is when ever they are redirected from browser after authentication, I cannot handle intent filters. Here is my code.
<activity
android:name=".DashboardActivity"
android:label="#string/title_activity_dashboard" />
<activity
android:name=".IntegrateActivity"
android:label="#string/title_activity_link_apps"
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="Link" />
<data android:host="redirect.html" />
</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="pdkMYID" />
</intent-filter>
</activity>
Only first filter is working. Does anybody know how to handle this,thanks in advance.
I think what you want isn't actually multiple filters but multiple schemas, which is supported.
<activity
android:name=".IntegrateActivity"
android:label="#string/title_activity_link_apps"
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="Link" />
<data android:scheme="pdkMYID" />
</intent-filter>
</activity>
That way matching any of those schemas will redirect to your Activity.

how to open this app via my website

<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:scheme="http" android:host="olacabs.com" android:pathPrefix="/app/launch" />
<data android:scheme="olacabs" android:host="app" android:pathPrefix="/launch" />
</intent-filter>
this is the manifest file of an android app ! how to open this app via my website?
for example i opened linkedin app using this code
Linkedin
same way i need to open above app also ! how to do that . i have tried with
OLA
OLA
OLA
please help me , thanks in advance
I'm not sure if you have figured out by now, but the correct way to have the same activity handle 2 or more URIs is to have multiple intent-filters:
<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:scheme="http" android:host="olacabs.com" android:pathPrefix="/app/launch" />
</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:scheme="olacabs" android:host="app" android:pathPrefix="/launch" />
</intent-filter>

Categories

Resources