Register Device
The registerDevice()
function is used to register User Device for Push Notifications.
Steps to Register User Device
- Create a
RegisterDeviceRequest
object usingRegisterDeviceRequest.builder()
class by passing all the required parameters. - Call
registerDevice()
function using the instance ofLMFeedClient
. - 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)
}
}