Beispiel #1
0
 internal PlayInstallReferrerDetails(PlayInstallReferrerError error)
 {
     Error = error;
 }
            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");
                        bool   googlePlayInstant             = ajoReferrerDetails.Call <bool>("getGooglePlayInstantParam");

                        PlayInstallReferrerDetails installReferrerDetails = new PlayInstallReferrerDetails(
                            installReferrer,
                            referrerClickTimestampSeconds,
                            installBeginTimestampSeconds,
                            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));
                }
            }