Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 3
0
 public AppUpdateSuccessListener(IAppUpdateManager appUpdateManager, Activity splashActivity, int updateRequest, Intent intent)
 {
     _appUpdateManager = appUpdateManager;
     _splashActivity   = splashActivity;
     _updateRequest    = updateRequest;
     _intent           = intent;
 }
Esempio n. 4
0
 public AppUpdateSuccessListener(IAppUpdateManager appUpdateManager, Activity mainActivity, int update_request, Intent intent)
 {
     _appUpdateManager = appUpdateManager;
     _mainActivity     = mainActivity;
     _update_request   = update_request;
     _intent           = intent;
 }
 public AppUpdateSuccessListener(IAppUpdateManager appUpdateManager, Activity mainActivity, int updateRequest, Intent intent)
 {
     try
     {
         AppUpdateManager = appUpdateManager;
         MainActivity     = mainActivity;
         UpdateRequest    = updateRequest;
         Intent           = intent;
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
Esempio n. 6
0
        // The restart dialog was only used to test the fakeappupdatemanager
        private void LaunchRestartDialog(IAppUpdateManager appUpdateManager)
        {
            AlertDialog.Builder dialog = new AlertDialog.Builder(_mainActivity);
            AlertDialog         alert  = dialog.Create();

            alert.SetMessage("Application successfully updated! You need to restart the app in order to use this new features");
            alert.SetCancelable(false);
            alert.SetButton((int)DialogButtonType.Positive, "Restart", (o, args) =>
            {
                appUpdateManager.CompleteUpdate();
                // You can start your activityonresult method when update is not available when using immediate update when testing with fakeappupdate manager
                //_mainActivity.StartActivityForResult(_intent, 400);
            });
            alert.Show();
        }
Esempio n. 7
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());
        }
 public AppUpdateSuccessListener(IAppUpdateManager appUpdateManager, Activity mainActivity)
 {
     _appUpdateManager = appUpdateManager;
     _mainActivity     = mainActivity;
 }