fixed crash when attempting to start connection for install referer
This commit is contained in:
parent
3577afea4e
commit
0ee9dbcea7
|
@ -31,7 +31,11 @@ public class InstallReferrerUtils implements InstallReferrerStateListener {
|
|||
return;
|
||||
}
|
||||
this.installReferrerClient = InstallReferrerClient.newBuilder(welcomeActivity).build();
|
||||
try {
|
||||
this.installReferrerClient.startConnection(this);
|
||||
} catch (SecurityException e) {
|
||||
Log.e(Config.LOGTAG, "unable to start connection to InstallReferrerClient", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void markInstallReferrerExecuted(final Activity context) {
|
||||
|
@ -41,17 +45,15 @@ public class InstallReferrerUtils implements InstallReferrerStateListener {
|
|||
|
||||
@Override
|
||||
public void onInstallReferrerSetupFinished(int responseCode) {
|
||||
switch (responseCode) {
|
||||
case InstallReferrerClient.InstallReferrerResponse.OK:
|
||||
if (responseCode == InstallReferrerClient.InstallReferrerResponse.OK) {
|
||||
try {
|
||||
final ReferrerDetails referrerDetails = installReferrerClient.getInstallReferrer();
|
||||
final String referrer = referrerDetails.getInstallReferrer();
|
||||
welcomeActivity.onInstallReferrerDiscovered(referrer);
|
||||
} catch (RemoteException e) {
|
||||
} catch (final RemoteException e) {
|
||||
Log.d(Config.LOGTAG, "unable to get install referrer", e);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, "unable to setup install referrer client. code=" + responseCode);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue