Beispiel #1
0
        public Menu()
        {
            InitializeComponent();
            IUpdateApp updateApp      = DependencyService.Get <IUpdateApp>();
            string     currentVersion = updateApp.GetVersion();

            lblVersion.Text = AppResources.VERSION + ": " + currentVersion;
        }
        async Task <bool> SendNotificationToken()
        {
            IUpdateApp updateApp = DependencyService.Get <IUpdateApp>();

            if (App.Current.Properties.ContainsKey(Const.CONFIG_GCM_TOKEN))
            {
                string token = (string)App.Current.Properties[Const.CONFIG_GCM_TOKEN];
                if (!string.IsNullOrEmpty(token))
                {
                    return(await new NotificationController().SendCurrentToken(token, updateApp.GetVersion()));
                }
            }
            return(false);
        }
        public async Task CheckAppUpdate()
        {
            if (DeviceInfo.Connectivity.InternetReachability == NetworkReachability.NotReachable)
            {
                return;
            }

            IUpdateApp updateApp      = DependencyService.Get <IUpdateApp>();
            string     currentVersion = updateApp.GetVersion();
            string     version        = await HttpRequest.GetStr(EndPointHelper.GetCheckAppVersionUrl(Device.OS));

            if (parseVersion(currentVersion) < parseVersion(version))
            {
                bool yes = await DialogHelper.ShowConfirm(AppResources.APP_TITLE, AppResources.UPDATE_APP);

                if (yes)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        updateApp.Update();
                    });
                }
            }
        }