[ad_1]
I am a begginer in react native and i am engaged on a cellular App. I want to set notification request permission however I acquired an issue : “parameter specified as non-null is null technique kotlin.jvm.inner.t.h, parameter permission”
I’ve been looking for a number of hours however I am unable to discover any answer to my downside which might be “silly”.
I discovered some explanations on react documentations but it surely does not works
https://reactnative.dev/docs/permissionsandroid
If somebody may assist me to grasp how can I resolve this downside or clarify me how does it really works, thanks you prematurely ! I proceed my analysis on my aspect.
import React from "react";
import {
Button,
PermissionsAndroid,
SafeAreaView,
StatusBar,
StyleSheet,
Textual content,
View,
} from "react-native";
const requestCameraPermission = async () => {
strive {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS,
{
message:
"Cool Photograph App wants entry to your digicam " +
"so you possibly can take superior photos.",
buttonNeutral: "Ask Me Later",
buttonNegative: "Cancel",
buttonPositive: "OK",
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("You should use the digicam");
} else {
console.log("Digicam permission denied");
}
} catch (err) {
console.warn(err);
}
};
const GetNotificationsPermissions = () => (
<View model={types.container}>
<Textual content model={types.merchandise}>Strive permissions</Textual content>
<Button title="request permissions" onPress={requestCameraPermission} />
</View>
);
const types = StyleSheet.create({
container: {
flex: 1,
justifyContent: "heart",
paddingTop: StatusBar.currentHeight,
backgroundColor: "#ecf0f1",
padding: 8,
},
merchandise: {
margin: 24,
fontSize: 18,
fontWeight: "daring",
textAlign: "heart",
},
});
export default GetNotificationsPermissions;
And sorry if I duplicate my query, I did not obtain any response from 1 week 🙂
[ad_2]
