Skip to main content

Register Device

The registerDevice() function is used to register User Device for Push Notifications.

Steps to Register User Device

  1. Create a RegisterDeviceRequest object using RegisterDeviceRequest.builder() class by passing all the required parameters.
  2. Call registerDevice() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<RegisterDeviceResponse>) as per your requirement.
// object of RegisterDeviceRequest
let request = RegisterDeviceRequest.builder()
.userId(userId) // User ID of the user
.deviceId(deviceId) // unique id of the device
.token(token) // FCM Token
.build()

LMFeedClient.shared.registerDevice(request) { response in
// get response (LMResponse<RegisterDeviceResponse>)
if (response.success) {
// process user logged out
processResponse()
} else {
// your function to process error message
processError(response.errorMessage)
}
}