I have been trying to make an app which opens automatically when a specific url is entered in the browser. To do so I've been using and intent filter within my manifest like so:
<intent-filter>
<data android:scheme="http" android:host="maltapark.com"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
</intent-filter>
This works fine but only in my default web browser. When I use chrome the app doesn't open.
I have also tried using firefox and it only opens my app with some but not all URLs such as abc://test.
Is there a way to get my app to open irrespective of the browser or URL being used please?
You could use the intent scheme, as explained here. The "Android Browser" may or may not support this, and you might have to rely on iframes. What FireFox does is anyone's guess, but personally I don't believe FireFox is a serious contender on the Android platform.
use this in manifest
<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="maltapark.com"
android:path="/"
android:scheme="TESTSCHEME" />
</intent-filter>
and use this in tag a
"intent://maltapark.com/#Intent;scheme=TESTSCHEME;package=com.YOURPACKAGENAME.www;end"
this is worked for me
What are the URL's you are trying to intercept with your app? You mentioned it doesn't work with something like abc://test, which is correct.
Your intent filter is declaring it wants to intercept urls that match http://maltapark.com.
If the url doesn't match that, it won't open.
try putting in the '*' wildcard in the andriod:scheme and maybe andriod:host attribute (if that is what you needed).
Related
I would like to open an app (if its installed) when I click on the link on my webpage. I've implemented App Links according to official docs but the link is opened in Chrome and my app is not offered to handle the link. If I click on the link in Messages app for example, it works correctly. I think that it's some limitation of the Chrome but I cant find anything online about that. If I try to turn off the verification for App links and implement it just like regular deeplinks it does not work either. Do I need to implement Chrome Intent
s?
This is my intent filter
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustNothing">
<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="mydomain.com"
android:pathPattern="/.*/app-microsite"
android:scheme="http" />
<data
android:host="www.mydomain.com"
android:pathPattern="/.*/app-microsite"
android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
I'm putting the comment by Simon Marquis, that helped me, here as an answer to that question, so following visitors might see it more easily.
Deep links are not working if you're using relative links on the same domain.
E.g. you have this page: example.com/index.html
This will open in browser
This will open the app
I want to write a NFC tag that opens a specific note in Google Keep when touched.
I have an URL in the form of https://keep.google.com/u/0/#LIST/<id> that does the desired action of opening the note in the installed Google Keep app on my phone when I read it with a QR-reader or click on it as a link.
When I write this URL to the tag an touch the tag afterwards, it opens in the browser. Is the NFC handler skipping other apps and opening it directly in a browser? When I clear the app-defaults for the browser, it shows a selection menu for the installed browsers after tapping the tag. Does anyone have an idea what I am doing wrong?
Links on NFC tags are not launched as intents with the typical VIEW action. Consequently, other apps may not pick those links up correctly and you will instead experience the web browser to be opened. Only apps that specifically register for the intent action NDEF_DISCOVERED will be able to receive links from NFC tags. It seems that Google Keep currently does not do this, so there's not much you can do without creating your own wrapper app that handles these URLs and passes them on to Google Keep.
You should enable deeplinks in your activity. Also you should indicate your activity NFC tag discoverable as follows. You can learn anything about deep linking via this link
<activity
android:name="ExampleActivity"
android:label="Example">
<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="example.com"
android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
I am using Branch.io to Deeplink from the Salesforce App to my Cordova app. However, when I click the deeplink in the Salesforce app, it just opens my app within a browser inside the Salesforce app instead of actually taking me to my app. It seems like I should be using a <intent-filter/> to make that happen but it doesn't seem to be able to take me out of the originating Salesforce app. Here is what my <intent-filter/> currently is:
<intent-filter android:name="io.branch.sdk.UriScheme">
<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>
<intent-filter android:autoVerify="true" android:name="io.branch.sdk.AppLink">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="myapp.app.link" android:scheme="https" />
</intent-filter>
What other intent actions or categories do I need there?
What actually definitively resolved this was going into the AndroidManifest.xml and setting android:launchMode="singleTask" on my main activity.
I know that in the android docs it says singleTask is not recommended. I believe that's because it prevents you from going back but we take over the functionality of the hardware back button so that's not relevant. Also according to this SO answer, it seems like the right thing to do in our context.
You should only need the intent filters listed here:
https://docs.branch.io/pages/apps/android/#configure-app
If it is opening your app within the Salesforce browser, then it may be that Salesforce is preventing users from deep linking out of it.
I'm trying to make one app link to open our app instead the browser.
The app links Assistant tells me that the pattern works fine but when I try it on the emulator or physical device it doesn't work :(
Filter:
<activity android:name=".activities.AppLinksActivity">
<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:scheme="http"
android:host="www.emagister.com"
android:pathPattern="/.*-cursos-.*.htm"
/>
</intent-filter>
</activity>
Url to match: http://www.emagister.com/curso-avanzado-lenguaje-programacion-javascript-cursos-2863146.htm
Assistant message:
Assistant image pic
But when I open it on the device or click run test i doesn't work and opens the browser.
If I put android:pathPattern="/juridico-master-compliance-officer-controller-juridico-empresarial-cursos-3299291.htm" in the manifest instead the above pathpattern everything works perfect.
What I'm doing wrong?
Thanks in advance!!
Your pathPattern regex seems unnecessarily complex; I don't believe it's documented which regex parser is used here, but I wouldn't be surprised if it's somehow choking on this.
Try simplifying as much as possible and then add elements back (but as few as possible). I suspect pathPattern='.*cursos.*' would still get you the same thing.
Can anyone tell me how can we make our browser as default in Android? I want to do so that
when you open up the internet browser, it gives you two options: regular browser and Mybrowser (third party browser which is made by me). If you select the regular browser, it says that the phone cannot access the internet unless it is on the Mybrowser. Can we implement this feature, and how?
set this in your AndroidManifest.xml for your activity:
<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="http" />
</intent-filter>