Untitled

 avatar
unknown
csharp
4 years ago
1.6 kB
5
Indexable
licensed => {
            if (licensed) {
                logLicense("License check successful");
            } else {
                logLicense("YOU ARE A PIRATE! Redirect to license url and QUIT");

                var licensingUrl = LicenseCheckAndroid.licensingUrl;
                if (licensingUrl.Any()) {
                    // Java: activity.startActivity(
                    //     new Intent(Intent.ACTION_VIEW, Uri.parse(licensingUrl))
                    //         .setPackage("com.android.vending"));
                    using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                    using (var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
                    using (var uriClass = new AndroidJavaClass("android.net.Uri"))
                    using (var uri = uriClass.CallStatic<AndroidJavaObject>("parse", licensingUrl))
                    using (var paywallIntent = new AndroidJavaObject("android.content.Intent","android.intent.action.VIEW", uri))
                    using (paywallIntent.Call<AndroidJavaObject>("setPackage", "com.android.vending" /* Play Store */)) {
                        activity.Call("startActivity", paywallIntent);
                    }
                } else {
                    logLicense("not licensed, but LicenseCheckAndroid.licensingUrl is empty");
                    OpenAppInStore();
                }

                Application.Quit();
            }

            FullVersionController.TryUnlockFullVersionAndReportAnalytics(licensed);
        }
Editor is loading...