Deferred deep linking in android - android

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

Related

Play Install Referrer vs Firebase Deeplinking

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.

Having a deeplink automatically direct to the Google Play Store or Apple App store depending on the device type

We will be sending, via SMS, a link to some of our clients that links them to the Google Playstore or Appstore to download our app.
If the user already has our app installed, the link prompts a "Open with ABC app?" message when clicked.
We want to use a single link, meaning it should somehow automatically pick up device type. Meaning if the user doesn't have our app installed, it appropriately redirects them to the app or playstore.
Our devs are insisting that using a single link is impossible, just trying to make sure this is really the case as I don't recall a lot of apps sending 2 separate links to download from.
Our devs are insisting that using a single link is impossible
I think your devs are trying to avoid work :P
https://firebase.google.com/docs/dynamic-links

Deferred Deep Linking URL in Android

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.

Deep linking not able to fallback to google market?

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.

Is is possible to pass a custom argument to android market so my app receives it on first launch?

Is there a way to pass a custom argument to android market (or any other way) so my app receives the argument after it gets installed (and run for the first time).
Let me explain.
Start an intent with argument1="Hello world1" (custom argument
every
time)
Install the app from android market.
Open the app for the first time.
App shows the msg "Hello world1"
Any case will do, not just intent to android market.
Most of the time the app will be installed via Barcode scanner with a binded http schema. So a browser workaround is possible too, HTML5 Client Side Storage, (store argument to browser and get it from there the first time my app runs)
Update
A solution would be to create a cookie,or something to the browser and then access it from the application i installed. Is that possible? If so can you provide some information about that? Can browsers share data with applications?
You can publish a link like that
http://market.android.com/details?id=your.package.name&referrer=your_referrer_parameter
After user clicks this link and installs the application your broadcast receiver will receive a broadcast com.android.vending.INSTALL_REFERRER with "your_referrer_parameter" value.
More info:
http://code.google.com/mobile/analytics/docs/android/#android-market-tracking
Get referrer after installing app from Android Market
Get Android Google Analytics referrer tag
AFAIK what you're asking is not possible. The market only delivers the APK files to devices. However depending on what exactly you want to do there are probably many different work arounds.
Here are a couple thoughts:
If you want the market to deliver a custom argument that is unique for every user, then why not have your app connect to a server on the initial run and download that argument? Even if the market could provide the argument it would have to get it from you and you would presumably have to setup a server to provide the market with the argument.
If you simply want the app to know wether or not it is running for the first time you can do that using a SharedPreference. Query if a preference like hasAppRunBefore exists and if it doesn't then you know the app is running for the first time since install. Then set the hasAppRunBefore variable to some value indicating that it has run before. This implementation will allow users to uninstall the app and reinstall it and after each reinstall the app will run for the first time again.
Another option is a combination of the first two. You can have the app connect to your server and provide the server with the device's UUID then the server can check if its seen that UUID before. If it hasn't it provides the argument otherwise it doesn't.
If you truly need each APK to be different for each device you can setup a server that when a download request is received it compiles a new APK and provides a link to download that APK. That will allow you to generate a new and unique APK for each download. This will however require you to distribute the APK yourself as the Android Market doesn't currently provide this functionality.
I would go ahead and have the website that redirects to the market also push a file to the client. the file can be named something like "yourapp.info" and contain the data you need. Once your app starts, it can search the SD card (it should reside in a couple of well known directories, aka /sdcard/Downloads ) and read that file. There are no access restrictions on the sdcard.
Regarding a Cookie in the browser: I'm not sure that you could access the cookie from just any other app - (check this: blog.watchfire.com/files/advisory-android-browser.pdf - it's not possible to access the cookies) so I think that route will be closed.

Categories

Resources