无法获取安装引荐来源网址信息-Android

时间:2019-03-07 17:12:41

标签: android install-referrer

我正在使用InstallReferrerClient来跟踪应用程序广告系列的安装。为确保触发InstallReferrerClient,我已将其放入应用程序的onCreate部分。

我无法获得有关广告系列应用安装的任何数据。 PlayStore绝对不会显示任何跟踪。我不明白为什么。我已经将其编码为:

 //setup install referrer client.
        installReferrerClient = InstallReferrerClient.newBuilder(this).build();
        installReferrerClient.startConnection(new InstallReferrerStateListener() {
            @Override
            public void onInstallReferrerSetupFinished(int responseCode) {
                Log.v(this.toString(), "Inside on install finished.");
                switch(responseCode) {
                    case InstallReferrerClient.InstallReferrerResponse.OK:
                        Log.v(this.toString(), "OK install.");
                        try {
                            ReferrerDetails referrerDetails = installReferrerClient.getInstallReferrer();
                            Log.v(this.toString(), "Printing referrer details:");
                            Log.v(this.toString(), "Referrer: " + referrerDetails.getInstallReferrer());
                            Log.v(this.toString(), "Referrer click timestamp: " + referrerDetails.getReferrerClickTimestampSeconds());
                            Log.v(this.toString(), "Referrer install begin timestamp: " + referrerDetails.getInstallBeginTimestampSeconds());
                            installReferrerClient.endConnection();
                        } catch (RemoteException e) {
                            Log.e(this.toString(), "Remote exception in Install referrer OK.");
                            e.printStackTrace();
                        }
                        break;

                    case InstallReferrerClient.InstallReferrerResponse.DEVELOPER_ERROR:
                        Log.v(this.toString(), "Developer error.");
                        break;

                    case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
                        Log.v(this.toString(), "Feature unsupported.");
                        break;

                    case InstallReferrerClient.InstallReferrerResponse.SERVICE_DISCONNECTED:
                        Log.v(this.toString(), "Service disconnected.");
                        break;

                    case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
                        Log.v(this.toString(), "Service unavailable.");
                        break;

                    default:
                        Log.v(this.toString(), "Some other option seen.");
                }
            }

            @Override
            public void onInstallReferrerServiceDisconnected() {
                Log.v(this.toString(), "Service disconnected. Will restart connection.");
                if(installReferrerClient != null) {
                    installReferrerClient.startConnection(this);
                }
            }
        });

0 个答案:

没有答案