I am developing an app in android studio and tracking referrer using referral link but my app not working in live condition
My app work fine when I send referrer using below command
adb shell
am broadcast -a com.android.vending.INSTALL_REFERRER -n com.example.app/.InstallReferrerReceiver --es "referrer" "123456"
but when I install my app using play store link https://play.google.com/store/apps/details?com.example.app&referrer=123456
then my app is not receiveing referrer
I already added receiver in my manifest file under application tag.
<receiver
android:name=".InstallReferrerReceiver"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
My InstallReferrerReciver
public class InstallReferrerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String referrer = intent.getStringExtra("referrer");
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (referrer != null) {
preferences.edit().putString("referral_code", referrer).apply();
}
}
}