// public API public static void GetInstallReferrerInfo(Action <PlayInstallReferrerDetails> callback) { PlayInstallReferrerDetails installReferrerDetails = new PlayInstallReferrerDetails( "test-install-referrer", 123456, 123456, 123456, 123456, "1.2.3.4.5.6", false); callback(installReferrerDetails); }
public void onInstallReferrerSetupFinished(int responseCode) { try { if (responseCode == installReferrerResponseCodes.FirstOrDefault(x => x.Value == "OK").Key) { Debug.Log("InstallReferrerResponse.OK status code received"); AndroidJavaObject ajoReferrerDetails = ajoInstallReferrerClient.Call <AndroidJavaObject>("getInstallReferrer"); if (ajoReferrerDetails == null) { Debug.LogError("getInstallReferrer returned null AndroidJavaObject!"); return; } String installReferrer = ajoReferrerDetails.Call <string>("getInstallReferrer"); long installBeginTimestampSeconds = ajoReferrerDetails.Call <long>("getInstallBeginTimestampSeconds"); long referrerClickTimestampSeconds = ajoReferrerDetails.Call <long>("getReferrerClickTimestampSeconds"); long installBeginTimestampServerSeconds = ajoReferrerDetails.Call <long>("getInstallBeginTimestampServerSeconds"); long referrerClickTimestampServerSeconds = ajoReferrerDetails.Call <long>("getReferrerClickTimestampServerSeconds"); String installVersion = ajoReferrerDetails.Call <string>("getInstallVersion"); bool googlePlayInstant = ajoReferrerDetails.Call <bool>("getGooglePlayInstantParam"); PlayInstallReferrerDetails installReferrerDetails = new PlayInstallReferrerDetails( installReferrer, referrerClickTimestampSeconds, installBeginTimestampSeconds, referrerClickTimestampServerSeconds, installBeginTimestampServerSeconds, installVersion, googlePlayInstant); this.callback(installReferrerDetails); } else if (responseCode == installReferrerResponseCodes.FirstOrDefault(x => x.Value == "FEATURE_NOT_SUPPORTED").Key) { Debug.LogError("InstallReferrerResponse.FEATURE_NOT_SUPPORTED status code received"); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, null); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } else if (responseCode == installReferrerResponseCodes.FirstOrDefault(x => x.Value == "SERVICE_UNAVAILABLE").Key) { Debug.LogError("InstallReferrerResponse.SERVICE_UNAVAILABLE status code received"); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, null); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } else if (responseCode == installReferrerResponseCodes.FirstOrDefault(x => x.Value == "DEVELOPER_ERROR").Key) { Debug.LogError("InstallReferrerResponse.DEVELOPER_ERROR status code received"); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, null); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } else if (responseCode == installReferrerResponseCodes.FirstOrDefault(x => x.Value == "SERVICE_DISCONNECTED").Key) { Debug.LogError("InstallReferrerResponse.SERVICE_DISCONNECTED status code received"); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, null); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } else { Debug.LogError("Unexpected response code arrived!"); Debug.LogError("Response: " + responseCode); Exception exception = new Exception("Unexpected response code arrived"); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, exception); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } } catch (Exception e) { Debug.LogError("Exception: " + e); PlayInstallReferrerError installReferrerError = new PlayInstallReferrerError(responseCode, e); this.callback(new PlayInstallReferrerDetails(installReferrerError)); } }