Пример #1
0
        public string SaveToken(string refreshedToken)
        {
            MobilePlatform platform = MobilePlatform.gcm;

            if (Device.RuntimePlatform == Device.Android)
            {
                platform = MobilePlatform.gcm;
            }
            if (Device.RuntimePlatform == Device.iOS)
            {
                platform = MobilePlatform.apns;
            }


            var deviceUpdate = new DeviceRegistration()
            {
                Handle   = refreshedToken,
                Platform = platform,
                Tags     = new string[1] {
                    refreshedToken
                },
                DeviceId = CrossDeviceInfo.Current.Id
            };

            Device.BeginInvokeOnMainThread(async() =>
            {
                await plantService.EnablePushNotifications(refreshedToken, deviceUpdate);
            });
            return("refreshedToken");
        }