/// <summary>
        /// Creates new simple alert and immediately shows it.
        /// </summary>
        /// <param name="title">Alert title.</param>
        /// <param name="message">Alert message.</param>
        public static void ShowMessage(string title, string message)
        {
            var builder = new UM_NativeDialogBuilder(title, message);

            builder.SetPositiveButton("Okay", () => {});

            var dialog = builder.Build();

            dialog.Show();
        }
Пример #2
0
        /// <summary>
        /// Use the <see cref="RequestReview"/>  method to indicate when it makes sense
        /// within the logic of your app to ask the user for ratings and reviews within your app.
        /// </summary>
        public static void RequestReview()
        {
            string appName       = Application.productName;
            string appIdentifier = Application.identifier;

            string title     = string.Format("Rate {0}!", appName);
            string message   = string.Format("If you enjoy using {0}, please take a moment to rate it.Thanks for your support!", appName);
            string noTitle   = "No, thanks";
            string rateTitle = "Rate";

            if (Application.isEditor)
            {
                var builder = new UM_NativeDialogBuilder(title, message);
                builder.SetPositiveButton(rateTitle, () => {});
                builder.SetNegativeButton(noTitle, () => {});

                var dialog = builder.Build();
                dialog.Show();
            }

            switch (Application.platform)
            {
            case RuntimePlatform.IPhonePlayer:
                ISN_SKStoreReviewController.RequestReview();
                break;

            case RuntimePlatform.Android:


                var dialog = new AN_AlertDialog(AN_DialogTheme.Default);
                dialog.Title   = title;
                dialog.Message = message;

                dialog.SetNegativeButton(noTitle, () => {
                });

                dialog.SetPositiveButton(rateTitle, () => {
                    //This code will take user to your app Play Market page
                    System.Uri uri       = new System.Uri("market://details?id=" + appIdentifier);
                    AN_Intent viewIntent = new AN_Intent(AN_Intent.ACTION_VIEW, uri);
                    AN_MainActivity.Instance.StartActivity(viewIntent);
                });

                dialog.Show();
                break;
            }
        }