Example #1
0
        /// <summary>
        /// Register/Unregister a Google Cloud Messaging registration ID.
        /// </summary>
        /// <param name="gcmRegistrationId">The GCM id to register.  A call with an absent value will unregister.</param>
        /// <param name="token">The cancellation token</param>
        /// <returns></returns>
        /// <exception cref="IOException"></exception>
        public async Task SetGcmIdAsync(string gcmRegistrationId, CancellationToken?token = null)
        {
            if (token == null)
            {
                token = CancellationToken.None;
            }

            if (gcmRegistrationId != null)
            {
                await pushServiceSocket.RegisterGcmIdAsync(gcmRegistrationId, token);
            }
            else
            {
                await pushServiceSocket.UnregisterGcmIdAsync(token);
            }
        }