Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install_referrer intent deprecation and update libraries

I have received email from google:

We recently announced that we’ll be deprecating the install_referrer intent broadcast mechanism. Because one or more of your apps uses this intent to track referrals, we wanted to ensure you make the switch before March 1, 2020. After this date, new versions of the Play Store app will no longer broadcast the install_referrer intent after app installs.

I checked this answer on Stack : install_referrer intent deprecation and follow the advice of waiting the update on Firebase libraries and now I update my project to the latest versions but still getting in INSTALL_REFERRER in my manifest merger under package="com.google.firebase.measurement_impl"

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.firebase.measurement_impl" >

<uses-sdk android:minSdkVersion="14" />

<!-- Required permission for App measurement to run. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />

<application>
    <receiver
        android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.INSTALL_PACKAGES" >
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>
</application>

here the firebase versions I uses in my project

    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
    implementation 'com.google.firebase:firebase-config:19.1.1'
    implementation 'com.google.firebase:firebase-auth:19.2.0'

and now after 5 days, 1 march will come and I didn't find a solution for this problem

like image 224
Neo Avatar asked Feb 26 '20 12:02

Neo


1 Answers

Google's installreferrer library solves this issue.

implementation 'com.android.installreferrer:installreferrer:1.1'

Follow this link to understand the implementation. Initialize the client on the launch activity of your app.

InstallReferrerClient referrerClient;
referrerClient = InstallReferrerClient.newBuilder(this).build();
referrerClient.startConnection(
    .... 
);

On successful initialization of the client you can store the referrer data obtained from the below code.

ReferrerDetails response = referrerClient.getInstallReferrer();
String referrerUrl = response.getInstallReferrer();

According to google:

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.

like image 107
saurabhlahoti Avatar answered Nov 05 '22 11:11

saurabhlahoti