Cancel Device Registration¶
To cancel the registration of a device with Backendless, an application can use the API described below:
Method¶
Blocking API
public void Backendless.Messaging.UnregisterDevice()
public void Backendless.Messaging.UnregisterDevice( List<String> channels )
Non-Blocking API
public Task Backendless.Messaging.UnregisterDeviceAsync()
public Task Backendless.Messaging.UnregisterDeviceAsync( List<String> channels )
where:
Argument | Description |
---|---|
channels |
Specify an array of channel names to unregister the device from. |
Return value¶
None.
Errors¶
The following errors may occur during the device registration cancellation API callThe following errors may occur during the device registration API call. See the Error Handling section for details on how to retrieve the error code when the server returns an error:
Error Code |
Description |
---|---|
5001 |
Unable to cancel device registration - unknown device ID. |
Example¶
Blocking API
// Example 1
Backendless.Messaging.UnregisterDevice();
// Example 2
List<String> channelsToUnregister = new List<String> { "default", "special_channel" };
Backendless.Messaging.UnregisterDevice(channelsToUnregister);
Non-Blocking API
// Example 1
await Backendless.Messaging.UnregisterDeviceAsync();
// Example 2
List<String> channelsToUnregister = new List<String> { "default", "special_channel" };
await Backendless.Messaging.UnregisterDeviceAsync(channelsToUnregister);
Codeless Reference¶
Returns the integer value identifying the number of channels which the device is still registered with in Backendless. This information is helpful to determine if the device should also be unregistered from FCM. When the number of remaining registrations in Backendless is zero, in some cases it might be needed to unregister from FCM as well.
The example below cancels the registration of a device with Backendless: