Home » Android » android – Google Play beta testing and Campaign Referrer

android – Google Play beta testing and Campaign Referrer

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have my application installed on Google Play as a beta product and part of the application logic is to retrieve the referrer parameters that are sent by Google Play when an application is installed. I have tested this using my own ADB broadcasts using the Android Studio and it works fine.

I am finding on beta that I am not receiving any broadcasts from google play and I assume that is because they do not broadcast for beta products when they are installed.

Can anyone confirm this for me or suggest a way that I test this properly in beta?

How to&Answers:

The broadcast should work even if the install was made through the beta channel, but it’s not 100% reliable due to system conditions.

In order to offer a most reliable channel to get information about installation and referrer, Google launched the Play Install Referrer Library that helps you to track the referrer information directly from Google Play instead of listening for a broadcast.

You add this to your build file:

dependencies {
    ...
    compile 'com.android.installreferrer:installreferrer:1.0'
}

And, during the 1st execution, connect to the API and check the referrer information:

InstallReferrerClient mReferrerClient
...
mReferrerClient = newBuilder(this).build();
mReferrerClient.startConnection(new InstallReferrerStateListener() {...});
...
ReferrerDetails response = mReferrerClient.getInstallReferrer();
response.getInstallReferrer();
response.getReferrerClickTimestampSeconds();
response.getInstallBeginTimestampSeconds();

There is a blog post with the announcement, for full details about implementation see the Play Install Referrer Library and the API reference documentation.