Notice of Change in Google Install Referrer Broadcast Operation
Follow
Key changes
On December 11, 2019, a notice was posted on the Google Developer Console regarding changes to the operation of install broadcasts.From the Google Play version updated on March 1, 2020, the broadcast receiver using "com.android.vending.INSTALL_REFERRER" will not deliver Google install referrer information.
Reference: [Still Using InstallBroadcast? Switch to the Play Referrer API by March 1, 2020]
<application> ... <receiver android:name="com.myapp.googleInstallReferrerReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> ... </application>
[You cannot receive Google Install Referrer with a broadcast receiver like above.]
From the point when these changes are applied, Google Install Referrer information can only be obtained through the Google Install Referrer API, not through broadcast receivers.
dependencies { implementation 'com.android.installreferrer:installreferrer:1.0' }
[To receive a Google referrer, you must register the Google Install Referrer API as shown above.]
Changes when linking DFINERY SDK
DFINERY already processes Google Install Referrer information using the Google Install Referrer API.
To apply Googles changes to your project, simply delete the broadcast receiver that uses com.android.vending.INSTALL_REFERRER from the AndroidManifest.xml file of your Android project.
[[Quote:Danger:Medium]]
Caution!!!
To measure inflow through Google Install Referrer, you must
add the Google Install Referrer API to gradle
.
Please refer to the following guide as it provides information on essential dependencies of the DFINERY SDK.
"
Integrating DFINERY (Adbrix) with Android [Java]: Gradle settings
"
We recommend removing items like the following from AndroidManifest.xml.
<receiver android:name="myapp.packagename.MyMultipleInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
[When using a custom InstallReceiver class]
<receiver android:name="com.igaworks.v2.core.AbxReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
[When using the install receiver Clash provided by DFINERY]
Obtaining Google Install Referrer Data
If you apply the above changes, you can use the DFINERY service without any problems.
However, there are times when you need to directly obtain and utilize Google Install Referrer data.
If you previously created a broadcast receiver to handle Google Install Referrer directly,
After the changes, you can obtain data using the Google Install Referrer API.
The following is a simple sample code to obtain Google install referrer data using ' com.android.installreferrer:installreferrer:1.0'.
/** * Attempts to connect to the Google Play app to obtain data through the Google Install Referrer API. * When the connection is successful in the result of onInstallReferrerSetupFinished, it performs the task of obtaining Google referrer information. * The sample below is based on 'com.android.installreferrer:installreferrer:1.0'. * * */ boolean isEnableToGetGoogleInstallRefererData = false; InstallReferrerClient referrerClient; referrerClient = InstallReferrerClient.newBuilder(MyActivity.this).build(); referrerClient.startConnection(new InstallReferrerStateListener() { @Override public void onInstallReferrerSetupFinished(int responseCode) { switch (responseCode) { case InstallReferrerClient.InstallReferrerResponse.OK: // Connection established. // When the connection to the Google Play app is successful, perform the task to obtain referrer data. isEnableToGetGoogleInstallRefererData = true; break; case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED: // API not available on the current Play Store app. break; case InstallReferrerClient.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. } }); /** * Performs the task of obtaining Google Install Referrer data when the connection to the Google Play app is successful. * * */ try { if(isEnableToGetGoogleInstallRefererData == true){ ReferrerDetails response = referrerClient.getInstallReferrer(); String referrerUrl = response.getInstallReferrer(); long referrerClickTime = response.getReferrerClickTimestampSeconds(); long appInstallTime = response.getInstallBeginTimestampSeconds(); } } catch (RemoteException e) { e.printStackTrace(); }