/// <summary> /// Configures a Realtime client and initialises <see cref="AndroidMobileDevice"/> which facilitates push notifications. /// </summary> /// <param name="callbacks">Callbacks for when the device is Activated, Deactivated or a SyncRegistration failed.</param> /// <returns>returns a realtime client which can be used in the app.</returns> public IRealtimeClient Configure(PushCallbacks callbacks) { var options = new ClientOptions { LogHandler = _loggerSink, LogLevel = LogLevel.Debug, // https://ably.com/docs/best-practice-guide#auth // recommended for security reasons. Please, review Ably's best practice guide on Authentication // Please provide a way for AblyRealtime to connect to the services. Having API keys on mobile devices is not recommended. Key = "<key>" }; // If we have already created a clientId for this instance then load it back. var savedClientId = AblySettings.ClientId; if (string.IsNullOrWhiteSpace(savedClientId) == false) { options.ClientId = savedClientId; } else { options.ClientId = Guid.NewGuid().ToString("D"); AblySettings.ClientId = options.ClientId; // Save it for later use. } return(AndroidMobileDevice.Initialise(options, callbacks)); }
/// <summary> /// Called when a new token for the default Firebase project is generated. /// </summary> /// <param name="token">The new token.</param> public override void OnNewToken(string token) { AndroidMobileDevice.OnNewRegistrationToken(token); }