是否有从Android的Google Play商店获取推荐代码的方法?

时间:2019-05-07 10:49:55

标签: java android google-play referrals

如果userA与userB共享链接引用,则当userB下载应用程序并执行某些功能时,应用程序会将userA的引用ID发送到后端以增加userA的积分

是否可以在我的应用代码中看到该引荐来源网址(如果有)?

我曾尝试使用Play安装引荐来源库 但返回的引荐来源字符串为 utm_source =(not%20set)&utm_medium =(not%20set) 推荐链接https://play.google.com/store/apps/details?id=com.sfn.android&referrer=9BE46550

然后尝试使用BroadcastReceiver 例如:

public class InstallReferrerReceiver extends BroadcastReceiver {
    public static String TAG = "InstallReferrerReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        String referrer = intent.getStringExtra("referrer");

        //Use the referrer
        Log.d(TAG, "onReceive:InstallReferrerReceiver " + referrer);
    }
}

在androidManifest.xml中:

    <application>
     <receiver
            android:name="com.gosnash.android.utils.InstallReferrerReceiver"
            android:exported="true"
            android:permission="android.permission.INSTALL_PACKAGES">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
    </application>

但也不行

0 个答案:

没有答案