This is the standard and expected behavior for Android's permission model. The system's permission dialog is designed to be shown to the user only once. After the user grants or denies the permission, subsequent calls to requestCallPermission will not show the dialog again, and as a result, the callback will not be triggered.
To correctly manage permissions, you should: 1. Use requestCallPermission only to initially ask the user for permission. 2. To check the current permission status at any other time (e.g., on app start), use the getCallPermissionStatus method instead.
Example Implementation:
// First, check the current permission status
pushwoosh.getCallPermissionStatus(
function(status) {
// status will be 0 (Not Determined), 1 (Granted), or 2 (Denied)
if (status === 0) {
// Permission has not been requested yet, so request it now.
pushwoosh.requestCallPermission(
function(granted) {
console.log('Call permission was ' + (granted ? 'granted' : 'denied'));
},
function(error) {
console.error('Error requesting call permission: ', error);
}
);
} else {
console.log('Call permission is already ' + (status === 1 ? 'granted' : 'denied'));
}
},
function(error) {
console.error('Failed to get call permission status: ', error);
}
);
Comments
0 comments
Please sign in to leave a comment.