const requestNotificationPermission = async () => {
try {
if (Platform.OS === 'android') {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS,
);
console.log({granted});
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('Notification permission granted');
} else {
console.log('Notification permission denied');
// Linking.openSettings();
}
}
} catch (error) {
console.error('Error requesting notification permission:', error);
}
};
I have already included in AndroidManifest file
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
googlePlayServicesVersion = "21.0.1"
Running on Android 11 physical device I have checked many solutions but no luck. Thanks