Register Device
The registerDevice()
function is used to register User Device for Push Notifications.
Steps to Register User Device
- Use the
registerDevice()
function provided by thelmFeedClient
object created earlier. - Create an instance of
RegisterDeviceRequest
, as shown in the snippet and pass it to the above method. - Use the response as per your requirement
try {
const RegisterDeviceRequest = RegisterDeviceRequest.builder()
.setUserId("<ENTER_USER_ID>") // User ID of the user
.setDeviceId("<ENTER_DEVICE_ID>") // unique id of the device
.setToken("<ENTER_TOKEN>") // FCM Token
.build();
const response = await lmFeedClient.registerDevice(RegisterDeviceRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}