Skip to content

Cancel Device Registration

To cancel the registration of a device with Backendless, an application can use the API described below:

Method

function unregisterDevice(): Promise<Object>;

Return value

Returns an object containing the result property:

{  
  "result" : "true" | "false",  
}

where:

Argument                Description
result When the operation is successful and the device registration is canceled, the operation returns true in this property. Otherwise, returns false.

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

Backendless.Messaging.unregisterDevice()

Codeless Reference

push_cancel_device_registration_1

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:

push_cancel_device_registration_2