Exemplo n.º 1
0
        private async Task RegisterForPush(string deviceToken)
        {
            // Update registration
            var api = new MyntApi();

            // Set to false before trying.
            Settings.IsDeviceRemoteRegistered = false;

            // Only available when connected.
            if (CrossConnectivity.Current.IsConnected)
            {
                var installation = new Installation()
                {
                    InstallationId = Settings.CurrentUniqueId,
                    Platform       = "apns",
                    PushChannel    = deviceToken
                };

                // Create our own push registration record.
                var id = await api.Register(installation);

                // If these match the registration was successful
                if (id != null)
                {
                    // Succesfully registered!
                    Settings.IsDeviceRemoteRegistered = true;

                    // Set the new device token.
                    Settings.DeviceToken = deviceToken;
                }
            }
        }