I want to implement deferred deep linking in my android app. My understanding is I need to provide a url and when user opens the url, it will direct user to the app or to play store if the app has not been installed. From my research, seems Android is able to resolve deferred deep linking by default. But my question is where is the URL from? Does Google have any url builder to generate it for me or do I need to have a website and write some code for the url?
Firebase Dynamic Links seems to be the official Android way to support the deferred deep link that will send user across the installation UI if needed. It also works with iOS and Web.
The answers and comments so far are all referring to normal deep linking. None of them will get you deferred deep linking (i.e., the ability to deep link even when the app is not installed yet and the user needs to first visit the Play Store to download it).
Vanilla iOS does not support deferred deep linking at all. Android can do it with the Android Google Play referrer, but it is unreliable and doesn't work at all from Chrome.
To do this, you'll likely want to investigate a free third-party service like Branch.io (full disclosure: I am on the Branch team). The Branch platform abstracts all the technical details and edge cases away, so all you need to worry about is defining a set of key/value parameters (for example: articleID: story123) when you create a link. Branch makes sure those parameters are returned to you inside the app the first time it launches after the user clicks the link, whether or not the app was installed when the link was clicked. You can then use the values to route/customize however you wish.
The url comes from any app or the user. Its just a normal app in the form http://example.com/path. THe magic is that your manifest registers an intent filter for the http scheme and the example.com/path path, and Android will take any intent that has an ACTION_VIEW for that url to your app. If your app isn't installed, since its an http url it falls back to the browser. If the url happens to go or redirect to the play store, then it gets you that behavior as well.
You can try using this scheme(to be sent to the user):
intent://details?id=X&url=Y&referrer=Z#Intent;scheme=market;action=android.intent.action.VIEW;package=com.android.vending;end";
X: Package name of the App
Y: Deep link scheme which should be defined in the App's manifest. (Please refer this) Here, they have used this URL as an example: "http://www.example.com/gizmos" , therefore Y should be replaced by this URL.
Z: Can be any data which you want to pass to the App via Google Play. Please take note that any data which you pass should not be '&' separated because the original parameters are itself '&' separated.
From what I experimented, this URL is understood by the browser and it redirects you to the App based on the package name and the deep-link scheme. Else it takes you to the Google Play.
PS: The Google Play makes a broadcast to the app. So make sure you receive the broadcast in a receiver.
Related
I want to have referral links to get the referral code with in the application (after installation) to provide credits based on the code for both Android and iOS.
I was able to explore these options:
1. Play Install Referrer API
Where the url would look something like: https://play.google.com/store/apps/details?id=com.example.myapp&referrer=utm_source%3Dstaff-referral%26utm_content%3713491235
Where I can get the content 713491235 using the Play Install Referrer API. However the problem here is this is very specific to Android and cannot work for iOS.
2. Firebase deep linking
Where the url would look something like: https://myapp.page.link/?link=https://mywebapp.com/713491235&apn=com.example.myapp
Where I can get the url https://mywebapp.com/713491235 using the Firebase deeplink api. This seems to solve for Android and iOS, but there isn't much information on how long the deeplink is alive, meaning
What happens if I install the app using deeplink but don't open the app for few days. Will it still be available when I open the app later.
What happens if I click on the link, but do not install then are there. Instead install it later by searching on playstore and installing. Will I still be able to get the link once the app is open?
Is there a way to combine both the Play Install Referrer API and Firebase deeplink? like - https://myapp.page.link/?link=https://mywebapp.com&apn=com.example.myapp&afl=https://play.google.com/store/apps/details?id=com.example.myapp&referrer=utm_source%3Dstaff-referral%26utm_content%3713491235 so that if the app is not installed on Android, we can use the Play Install Referrer API(which looks more reliable).
And I am not able to understand the purpose of Play Install Referrer Links, if they are not converted to universal links, because often we don't know which device the url will be used on. Sharing a link specific to playstore doesn't seem to help. What exactly is the usecase of Play Install Referrer?
Because in case of Play Install Referrer API they were clearly mentioning:
Caution: The install referrer information will be available for 90
days and won't change unless the application is reinstalled. To avoid
unnecessary API calls in your app, you should invoke the API only once
during the first execution after install.
I'll answer your questions one by one - I think Firebase Dynamic Links are the better choice for you, based on your requirements.
I couldn't find anything in the documentation for this, but it seems that the link will expire roughly 1 hour from install time (as said here and here).
Android and iOS integration methods are interestingly different in Firebase - if an new iOS user taps the link, it will copy the Dynamic Links URL to the clipboard and read it when the app is opened, whereas Android calls the intent handler for the URL, which in turn calls a Firebase function that extracts the link.
This means that an iOS link, until a user copies something else, should still work - which effectively means a short lifetime, as you can't rely on your users not copying something else. For Android, though, the intent handler is the link - if a user breaks the flow, it'll no longer work.
From a technical view, you could completely create a double-link - I'm not sure whether that would be needed, though, as I'm not sure on how the Play Install Referrer API works and I assume it will use a similar method with them both being developed by Google.
The main use case of the Play Install Referrer API is to track the effectiveness of ad campaigns on a mobile app - the data received from the API is similar to the UTM parameters at the end of a URL (e.g. utm_campaign, utm_source) that tell the website owner where the user comes from. They can be used in situations where the advert knows what your device OS is - for example, an advert inside another app.
Objective : I have 2 apps (Say A & B).
Case 1:
When app B is installed and I launch a page (say product page) on app A it will land to same product page of app B.
Case 2:
When app B is not present and I launched it from app A it will land to play store and and after installing it will open the same launched page of app A in app B.
I have followed https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder
but unfortunately didn't get any success.
I want to create it without any third party library like branch/facebook etc.
Please suggest something.
What you're describing is called Deferred Deep Linking (Deep Linking refers to using a link to open your app directly to a specific piece of content, and Deferred means that it works even if the app isn't installed first).
Unfortunately there's no native way to accomplish this on either iOS or Android. The Google Play INSTALL_REFERRER could work in theory, but it's unreliable and often gets delivered too late (i.e., seconds to minutes of waiting) to provide a good UX. URL schemes don't work, because they always fail with an error if the app isn't installed. Universal Links in iOS 9+ and App Links on Android 6+ at least don't trigger an error if the app isn't installed, but you'd still have to handle redirecting the user from your website to the App Store. You still can't pass context through to the app after install with Universal Links and App Links, so you wouldn't be able to send the user to the correct item.
To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do. Free services like Branch.io (full disclosure: they're so awesome I work with them) and Firebase Dynamic Links exist precisely to handle all of this for you, and we have a number of partners who build app-to-app connections like this.
I'd love to hear any feedback on why you are hesitant to use a third-party library!
Below is my scenario:
If the app is installed, launch the app pass a referrer data and handle it inside the app.
If the app is not installed , direct to google play install the app handle the referrer data.
I am able to achieve first case
For scenario 1 , I have
link 1:
http://www.xxx.co.in/main?id=4&referrer="+referrer
My activity is configured correctly and I am able to achieve scenario 1.
For scenario 2, I have
final String url = "http://www.xxx.co.in/main?id=4&referrer="+referrer+"#Intent;scheme=market;action=android.intent.action.VIEW;package=com.xxx&referrer="+referrer+";end";
This I am not able to achieve, If the app is not installed, instead of directing me to google play, it tries to open www.xxx.co.in/main.... in browser.
What is wrong here and how to achieve this.
NOTE: I do not want to host my own server hence redirecting from a remote server is out of scope.
Are you opening this link in the native Android browser, or Chrome? That looks like an Intent link, so it will only work in Chrome even if it is formatted correctly. However, Chrome doesn't support the Android Play referrer
To be honest, this sounds like a perfect use case for an external deferred deep linking service like Branch.io (full disclosure: I'm on the Branch team). Branch links do exactly what you're describing, and they do it on all browsers while saving you from the headache of needing to handle all the different variations. All you need to worry about is defining a set of key/value parameters (for example: articleID: story123) when you create a link, and Branch makes sure those parameters are returned to you inside the app the first time it launches after the user clicks the link, whether or not the app was installed when the link was clicked. You can then use the values to route/customize however you wish.
How can we get deferred deep linking work when the android app is installed from any third party location other than Play Store, say GDrive or S3 bucket. How to pass intent data in this case? Thanks in advance.
Simple as this sounds, it's actually a bit complicated to implement. You probably already know about the InstallReferrerReceiver, but that's obviously only for the Play Store.
You basically need to come up with some way to store data outside the app before it is downloaded, and then retrieve it inside the app after installation. Branch.io (full disclosure: I'm on the team) does this by using unique link IDs, to which we can attach a data dictionary. When a user opens that link prior to downloading, we tag their device ID and then redirect them to the specified URL (e.g., GDrive or S3). We match the device ID again after the app is launched the first time. This allows us to pass an unlimited amount of data with each link, since the data isn't actually stored in the link itself
My requirement is, There is an advertisement in an email for a shoe, if I click on that ad, it should open my app directly and take me to corresponding page without asking any available option like web browser, etc.
I tried Deep linking fundamental, But I don't know how to create deep links, from where I can get custom scheme(eg. testlink://test).
for eg. google play scheme is market://details/
Thanks in advance
To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest.
refer https://developer.android.com/training/app-indexing/deep-linking.html
https://developers.google.com/app-indexing/android/app
There are actual several questions at play here:
1 - You need to know how to create a URI scheme(the testlink:// protocol you reference).
2 - You need to make your app do something when the end user clicks on the deep link.
To begin at the beginning, you don't "get" the custom scheme from anywhere, you create a URI scheme as part of setting up your app. There is no real standardization as to what that scheme should be (despite some attempts).
The question of how to do this have been answered elsewhere (How to implement my very own URI scheme on Android and in the android docs).
And I actually just published a blog post with some suggestions on how to optimize that URI scheme (https://blog.branch.io/creating-uri-schemes-for-app-content-discovery).
The second question is easier. Once you have that scheme in place, a user who
(a) clicks on a link that matches your scheme
(b) has your app installed and
(c) doesn't have some other app installed which uses the same scheme and which they've already set as the default for that scheme
will be launched directly into your app to the exact location / experience that you defined when you were setting up your intent filters.
Now if you want your deep links to work for users who don't already have your app installed you'll need to use a deferred/contextual deeplinking service. Obviously I'm inclined towards Branch.io since I work for them, but I work for them because I think they have the best offering.
Regarding your last requirement, that there be no browser pop in between, the browser pop is usually part of the flow because it allows a deep linking service to pass some information to their servers about the user on click so that if the user does not have the app they can be directed to the app store and if they do have the app it can be launched by invoking your URI scheme. If you want to do any sort of matching between click and install for users who do not already have the app or pass any info from the click to the app once it launches it been simply unavoidable until now. Universal links on iOS (new in iOS9) change that. They can be invoked directly without needing to go through the browser and pass data directly into the app being launched, which is a pretty big deal. Google is expected to announce an equivalent for Android in the very near future. The setup is a bit intense, but worth it for the improved user experience.
Good luck!