Push Permission Status Change
An event that keeps an eye if customer has granted permission for Push or not.
Description
The onPermissionStatusChanged listener triggers whenever the device’s permission state changes for supported features — most importantly Push Notification permissions.
This listener is essential for detecting when a user has granted or revoked push permissions, either:
- Immediately after calling
requestPermissions("push"), or - When the user manually enables/disables notifications from device settings.
Use this event to update UI elements, enable push-only features, or prompt users when permissions are denied.
Function Signature
VajroSDK.listeners.onPermissionStatusChanged(() => {
// Do the necessary logic
});| Parameter | Type | Required | Description |
|---|---|---|---|
| Nil | Nil | Nil | This listener does not require any parameter. |
Example Usage
function checkPushPerm() {
let permission = VajroSDK.variables.device.permissions.notification;
VajroSDK.listeners.onPermissionStatusChanged(() => {
document.getElementById("test_data_visibility").innerHTML += permission;
if (permission == "denied") {
VajroSDK.actions.showToast({
title: "Oops!!",
message: "Please enable Push."
});
VajroSDK.actions.requestPushPermission();
} else {
VajroSDK.actions.showToast({
title: "YAAY!!",
message: "Push Enabled"
});
}
});
}
checkPushPerm();Best Practices
- Use this listener after requesting push permissions to determine user action.
- Update UI dynamically — hide "Enable Notifications" button when permission is granted.
- Cache permission status if needed for business logic.
- Show clear, friendly messaging when the user denies permission.
- Consider using this listener during onboarding flows to track permission onboarding success.
Caveats
- Listener fires only after a permission state changes (not on initial load).
- The payload may not include all permissions — only those supported by the device + app version.
Updated about 1 month ago