Register Device for Notifications
To receive push notifications, you need to register a device using the registerDevice()
function.
Steps to Register a Device
Build a
RegisterDeviceRequest
object using theRegisterDeviceRequestBuilder
class.Call the
registerDevice()
function using the instance of theLMFeedClient
class.Use the response as per your requirement.
// Provide device details for registration
String token = "device_token_here";
String deviceId = "device_id_here";
int memberId = 123; // replace with actual member ID
// Build the request object
RegisterDeviceRequest request = (RegisterDeviceRequestBuilder()
..token(token)
..deviceId(deviceId)
..memberId(memberId))
.build();
// Get the response from calling the function
final RegisterDeviceResponse response = await lmFeedClient.registerDevice(request);
// Process the response, as per requirement
if(response.success){
// your function to handle successful device registration
handleDeviceRegistration(response);
}else{
// your function to handle error message
handleRegistrationError(response.errorMessage);
}
tip
Registering a device allows it to receive push notifications from the LikeMinds Feed.
Models
RegisterDeviceRequest
List of parameters for the RegisterDeviceRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
token | String | Device token for notifications | |
deviceId | String | Unique ID of the registered device | |
memberId | int | Member ID associated with the device |
RegisterDeviceResponse
List of parameters for the RegisterDeviceResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
errorMessage | String | Error message in case of failure | ✔ |
success | bool | API success status |