Application open within application - android

I have implemented deeplinking in my application that open my app (if available) but my app opens within other application. I want it should open out of the other app.
Here is my code for deeplinking.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="controller"
android:path="/productDetail"
android:scheme="lalaland" />
</intent-filter>
Example: If i hit a url in slack it opens my app ( lalaland ) with in slack.

You are at the mercy of the application that the user executed the deep-link from.
I'm afraid there is no solution for this. For example, Facebook messenger butchers deep-links rendering them unusable in many cases, same with the Samsung messaging app.
What you see here is Slack hijacking the deep-link and forcing it to open within its own app.

Related

Android AppLink prompting for app and chrome

I am trying to implement an AppLink (deeplink) such that when the app-link is triggered it does not bring up the popup asking for my App or Chrome, I want it to just launch my app so I can direct them to the proper place in the app.
I have read various android articles and posts and cannot get the AppLink to work the way I want.
Here is my manifest xml:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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.example.com" />
</intent-filter>
<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="https"
android:host="www.example.com" />
</intent-filter>
</activity>
I read in the android doc here the following:
A deep link is an intent filter that allows users to directly enter a
specific activity in your Android app. Clicking one of these links
might open a disambiguation dialog, which allows the user to select
one of multiple apps (including yours) that can handle the given URL.
For example, figure 1 shows the disambiguation dialog after the user
clicks a map link, asking whether to open the link in Maps or Chrome.
Android App Links are a special type of deep link that allows your
website URLs to immediately open the corresponding content in your
Android app (without requiring the user to select the app).
I added auto verify to the intent and have the assetlinks.json file but still prompts to choose my app or chrome. I DO NOT want the prompt for chrome... only my app.
So, what am I missing?
Has anyone here got an app link to work that DOES NOT pop up the option for Chrome?
Can anyone point me to a sample app or code or an article that actually works?
Thanks for any assistance with this.

How do I open a link from an NFC tag?

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>

Prevent Deeplink from being opened within the browser of the originating app

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.

Android deep link: App chooser is triggered for each subdomain

So I have an app with deep linking that can open links from the company website.
I do this by adding an intent-filter to an Activity tag like so:
<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="*.company.com"
android:scheme="https" />
</intent-filter>
The problem is that the website has multiple subdomains that each trigger the app chooser. (category1.company.com, category2.company.com etc)
If it were using only one domain, the app chooser would appear only once when opening the main page, the user would choose to continue in the browser "just once" and navigate the website without interruption.
With subdomains, each time the user navigates to a different subdomain he sees the app chooser and has to click "just once" again.
Is there any way to configure the app to display the app chooser only the first time you go on that domain and not for each subdomain?
Have you try several data block in the same intent filter
<data
android:host="category1.company.com"
android:scheme="https" />
<data
android:host="category2.company.com"
android:scheme="https" />
....
use app-ink instead, so android will not ask and just open your app.
you can use a wildcard since Android 6 to include all subdomains.
https://developer.android.com/training/app-links

returning back to the android app, from the browser, without restarting the app

I am using Phonegap to create an android application. The application has a feature that enables the user to visit a micro site by opening the android web browser. The micro site has a return button that will return the user back to the app.
I created my own scheme so I can launch the app from the android browser.
<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="microsite" />
</intent-filter>
My problem is that when the app is launch from the browser, the app is restarted.
How will I be able to return to the app without restarting the app? How to return to where I left off?

Categories

Resources