我想从我的应用内的Google Play网址获取引荐来源网址查询参数。
https://play.google.com/store/apps/details?id=<apppid>&referrer=myReferrerValue
我写了这个
InstallReferrerClient referrerClient;
referrerClient = InstallReferrerClient.newBuilder(this).build();
referrerClient.startConnection(new InstallReferrerStateListener() {
@Override
public void onInstallReferrerSetupFinished(int responseCode) {
switch (responseCode) {
case InstallReferrerClient.InstallReferrerResponse.OK:
Log.d("InstallReferrerResponse","Connection established");
ReferrerDetails response = null;
try {
response = referrerClient.getInstallReferrer();
String referrerUrl = response.getInstallReferrer();
Log.d("InstallReferrerResponse",referrerUrl);
} catch (RemoteException e) {
e.printStackTrace();
}
break;
case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
Log.d("InstallReferrerResponse","API not available on the current Play Store app");
break;
case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
Log.d("InstallReferrerResponse","Connection couldn't be established");
break;
}
}
@Override
public void onInstallReferrerServiceDisconnected() {
}
});
但是我只得到utm_source=google-play&utm_medium=organic
,没有得到Referrer = myReferrerValue。
如何获取Referrer = myReferrerValue?