Permission Management
The SDK provides a method to manage permission for sending push notifications to the user. This function updates the permission status and communicates it to the API via the push service.
To request or update the push notification permission, use the following function:
EZPush.permission(permissionGranted)
permissionGranted (Boolean): Indicates whether the permission is granted (true) or not (false). overrideStatus (Boolean): Determines whether the current permission status should be overridden. This parameter defaults to true, meaning the permission status will be updated and sent to the API. Set this to false only when the user has not been explicitly asked to change the permission status, such as when updating the status automatically on startup. If set to false, the value will update only if it was previously saved (i.e., the user was asked explicitly before). When the permission is not granted, our backend will not send push notifications to the user. This function ensures that the current permission status is saved and communicated accurately.
Usage Example
To grant permission and update the status:
EZPush.permission(true)
To deny permission and update the status:
EZPush.permission(false)
To update the permission status without overriding the current status (typically used when the user has not been explicitly asked to change their preference. For example user with Android API <13 where the permission default to true):
EZPush.permission(false, overrideStatus = false)
By using this function, you can effectively manage user permissions for push notifications, ensuring compliance with user preferences and regulatory requirements.