Expo CLI 4.8.1 environment info:
System:
OS: macOS 11.6
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.5 - /usr/local/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 7.20.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
Android SDK:
API Levels: 29, 30
Build Tools: 29.0.2, 31.0.0
System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7199119
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
npmPackages:
expo: ~42.0.1 => 42.0.3
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
npmGlobalPackages:
expo-cli: 4.9.1
Expo Workflow: managed
I try to implement expo notifications and I have an issue on the first step, ask permission.
On ios, I tried the exemple of the documentation (just this to ask permision) :
let token;
if (Constants.isDevice) {
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!');
return;
}
token = (await Notifications.getExpoPushTokenAsync()).data;
console.log(token);
} else {
alert('Must use physical device for Push Notifications');
}
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('default', {
name: 'default',
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: '#FF231F7C',
});
}
return token;
};
Here is my app.json:
{
"expo": {
"name": "green-got-preview",
"slug": "green-got-preview",
"scheme": "green-got-preview",
"version": "1.1.2",
"orientation": "portrait",
"icon": "./assets/images/app-icon.png",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash2.png",
"resizeMode": "cover",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"bundleIdentifier": "com.green-got.preview",
"buildNumber": "1.0.0",
"supportsTablet": true,
"infoPlist": {
"NSCameraUsageDescription": "Nous avons besoin d'utiliser votre caméra pour la création du compte"
}
},
"android": {
"package": "com.green_got.preview",
"permissions": [
"CAMERA",
"RECORD_AUDIO",
"CAMERA_ROLL",
"VIBRATE",
"com.google.android.c2dm.permission.RECEIVE"
],
"versionCode": 1,
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"favicon": "./assets/images/favicon.png"
}
}
}
I have no prompt or alert to request / enable permission and the status when is not granted is always undetermined
Am I missing a configuration in my app.json ?
any idea?