コード例 #1
0
        protected override async System.Threading.Tasks.Task RunAppStartAsync(Bundle bundle)
        {
            if (!await IsPlayServicesAvailable())
            {
                return;
            }

            SetAppTheme();

            var intent = new Intent(this, typeof(AndroidMainActivity));

            intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);

            if (Intent.Extras != null && Intent.Extras.ContainsKey("FCMMessage"))
            {
                foreach (var key in Intent.Extras.KeySet())
                {
                    var value = Intent.Extras.GetString(key);
                    intent.PutExtra(key, value);

                    Log.Debug("AndroidSplashScreenActivity", "Key: {0} Value: {1}", key, value);
                }
            }

            IAppUpdateManager appUpdateManager = AppUpdateManagerFactory.Create(this);
            var appUpdateInfoTask = appUpdateManager.AppUpdateInfo;

            appUpdateInfoTask.AddOnSuccessListener(new AppUpdateSuccessListener(appUpdateManager, this, RequestUpdate, intent));
        }
コード例 #2
0
        //private readonly IReviewManager _reviewManager;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());

#if DEBUG
            //var manager = ReviewManagerFactory.Create(this);
            //var request = _reviewManager

            var appUpdateManager = new FakeAppUpdateManager(this);

            /* The below line of code will trigger the fake app update manager which it will display the alert dialog
             * Let say if we comment this line of code to simulate update is not available then the play core update not available flag
             * will be captured on the appupdatesuccess listener.
             * If comment this line it will simulate if the app update is not available. Then you can add logic when update is not available using immeidate update*/
            appUpdateManager.SetUpdateAvailable(2); // your higher app version code that can be used to test fakeappupdate manager
            //Com.Google.Android.Play.Core.Review
#else                                               // The below line of code will execute in release configuration
            IAppUpdateManager appUpdateManager = AppUpdateManagerFactory.Create(this);
#endif
            var appUpdateInfoTask = appUpdateManager.AppUpdateInfo;
            appUpdateInfoTask.AddOnSuccessListener(new AppUpdateSuccessListener(appUpdateManager, this, _Request_Update, Intent));
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            _appUpdateManager = AppUpdateManagerFactory.Create(this);

            UserDialogs.Init(this);
            Rg.Plugins.Popup.Popup.Init(this);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Xamarin.Forms.Forms.SetFlags("Shapes_Experimental");
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            Xamarin.FormsMaps.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
コード例 #4
0
        public static void CheckUpdateApp(Activity mainActivity, int updateRequest, Intent intent)
        {
            try
            {
                // Creates instance of the manager.
                var appUpdateManager = AppUpdateManagerFactory.Create(mainActivity);

                // Returns an intent object that you use to check for an update.
                var appUpdateInfoTask = appUpdateManager.AppUpdateInfo;
                // Checks that the platform will allow the specified type of update.
                appUpdateInfoTask.AddOnSuccessListener(new AppUpdateSuccessListener(appUpdateManager, mainActivity, updateRequest, intent));
                appUpdateInfoTask.AddOnFailureListener(new AppUpdateOnFailureListener());

                Console.WriteLine(appUpdateInfoTask);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
 private IAppUpdateManager GetManager()
 {
     // Creates instance of the manager.
     return(AppUpdateManagerFactory.Create(this));
 }