Im trying to implement push notifications using Expo. It worked before I detached my app. No Im trying to get the native device token using Expo. (I’ve also tried Permissions.REMOTE_NOTIFICATIONS.
Permissions.askAsync(Permissions.NOTIFICATIONS).then(status => {
if(status === 'granted') {
Notifications.getDevicePushTokenAsync()
.then(token => {
Alert.alert(
'This is your token',
`${token}`, [{text: 'OK', onPress: () => console.log('OK Pressed')},], {cancelable: false}
);
this.setState({token});
})
.catch(err => {
this.setState({error: err.toString()});
});
Notifications.getExpoPushTokenAsync()
.then(token => {
Alert.alert(
'This is expo token',
`${token}`, [{text: 'OK', onPress: () => console.log('OK Pressed')},], {cancelable: false}
);
})
.catch(err => {
console.log(err);
})
}
});
I never receive the device token. Any thoughts?
I’ve also tried to implement PushNotificationIOS 🚧 PushNotificationIOS · React Native
But I get build errors in the native xcode project. Saying it could not find file #import <React/RCTEventEmitter.h>
This works fine when I create a new react-native init project and implement PushNotificationIOS
Any thoughts?