Registering a device associates it with a user and tells the push provider to deliver notifications to the device.
Register the user's device for push notifications once your user is successfully connected.
Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration that you've set up in the dashboard or via the API.
Registering a device associates it with a user and tells the push provider to send new message notifications to the device.
Register the user's device for remote push notifications once your user is successfully connected to Chat.
Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration that you've set up in the dashboard or via the API.
const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";const push_provider = "apn";const user_id = "Taquito";await client.addDevice(id, push_provider, user_id);// if multi providersawait client.addDevice(id, push_provider, user_id, push_provider_name);
client.addDevice( Device( token = "push-provider-token", pushProvider = PushProvider.FIREBASE, providerName = "provider_name", // Optional, if adding to multi-bundle named provider )).enqueue { result -> if (result.isSuccess) { // Device was successfully registered } else { // Handle error }}
func application( _ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // Note: If you leverage mutli-bundle configuration, please provide providerName - name of your configuration chatClient.currentUserController().addDevice(.apn(token: deviceToken)) { error in if let error = error { print("Error adding device token.", error) } }}
// register the device with APN (Apple only)await client.addDevice('device-token', PushProvider.apn);// register the device with Firebase (Android only)await client.addDevice('device-token', PushProvider.firebase);
await Client.DeviceApi.AddDeviceAsync(new CreateDeviceRequest{ //Device ID provided by the notifications provider e.g. Token provided by Firebase Messaging SDK Id = "unique-device-id", PushProvider = PushProviderType.Firebase,});
// register the device with APN (Apple only)Client->AddDevice(TEXT("device-token"), EPushProvider::Apn);// register the device with Firebase (Android only)Client->AddDevice(TEXT("device-token"), EPushProvider::Firebase);
Register a device to associate it with a user and enable push notifications for activity updates.
Register the user's device for push notifications once your user is successfully connected to Activity Feeds.
Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration you've set up in the dashboard.
client.getDevices().enqueue { result -> if (result is Result.Success) { val devices: List<Device> = result.value } else { // Handle error }}
let currentUserController = chatClient.currentUserController()currentUserController.synchronizeDevices { error in guard error == nil else { print("Error getting the list of devices") return } let devices = currentUserController.currentUser?.devices}
var response = await Client.DeviceApi.ListDevicesAsync(Client.UserId);foreach (var userDevice in response.Devices){ Debug.Log(userDevice.Id); // Unique Device ID provided by push notifications provider Debug.Log(userDevice.CreatedAt); Debug.Log(userDevice.PushProvider); //E.g. Firebase Debug.Log(userDevice.Disabled); Debug.Log(userDevice.DisabledReason);}
Client->ListDevices( [](const TArray<FDevice> Devices) { // Do something with Devices });
public struct Device { public var createdAt: Date public var disabled: Bool? public var disabledReason: String? public var id: String public var pushProvider: String public var pushProviderName: String? public var userId: String public var voip: Bool?}
Unregistering a device removes the device from the user and stops further new message notifications.
const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";const user_id = "Taquito";await chatClient.removeDevice(id, user_id);
client.deleteDevice( Device( token = "push-provider-token", pushProvider = PushProvider.FIREBASE, providerName = "custom_name", // Optional, if added to multi-bundle named provider )).enqueue { result -> if (result.isSuccess) { // Device was successfully unregistered } else { // Handle error }}
let currentUserController = chatClient.currentUserController()guard let device = currentUserController.currentUser?.currentDevice else { // No device to remove}currentUserController.removeDevice(id: device.id) { error in if let error = error { print("Error removing the device", error) }}