There are two parts to this problem, first part is easy and there are solutions on the web but it's the second part that's baffling for which a solution was described vaguely but didn't make any sense.
A link is to be shared via text message that will take to the store if app is not installed or open the app in the relevant section.
While the data being passed is somehow reported to the server as well, somehow the android OS is reporting to the server, may be as part of analytics, somehow a connection is made that can help me identity who this specific user installing the app is, and customize the content of this deeply linked page based on his identity.
What can I try to solve the second issue?
As the question focuses on #2. Let me explain.
For users who haven't already installed your app, there is a referral program directly managed by Google Playstore.
You need to implement their referrer gradle package in your dependencies section.
dependencies {
implementation 'com.android.installreferrer:installreferrer:1.1'
}
Please find the detailed info on what code to be added in your Android app here. https://developer.android.com/google/play/installreferrer/library
Please add the following code block to make a connection to Google Playstore in your launcher activity.
InstallReferrerClient referrerClient;
referrerClient = InstallReferrerClient.newBuilder(this).build();
referrerClient.startConnection(new InstallReferrerStateListener() {
@Override
public void onInstallReferrerSetupFinished(int responseCode) {
switch (responseCode) {
case InstallReferrerResponse.OK:
// Connection established.
ReferrerDetails response = referrerClient.getInstallReferrer();
String referrerUrl = response.getInstallReferrer();
long referrerClickTime = response.getReferrerClickTimestampSeconds();
long appInstallTime = response.getInstallBeginTimestampSeconds();
boolean instantExperienceLaunched = response.getGooglePlayInstantParam();
break;
case InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
// API not available on the current Play Store app.
break;
case InstallReferrerResponse.SERVICE_UNAVAILABLE:
// Connection couldn't be established.
break;
}
}
@Override
public void onInstallReferrerServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
});
You will be able to retrieve the following info from the API.
ReferrerDetails response = referrerClient.getInstallReferrer();
String referrerUrl = response.getInstallReferrer();
long referrerClickTime = response.getReferrerClickTimestampSeconds();
long appInstallTime = response.getInstallBeginTimestampSeconds();
boolean instantExperienceLaunched = response.getGooglePlayInstantParam();
This API is available only on devices with a Googleplay app version of 8.3.73 or later.
Now if the app is already installed and you open a link, basic deep linking (with a receiver registered in your Manifest file) will take care of the job.
This should provide you a starting point.