I am building a React native app which is based on Expo , i use Expo's push notification . when i test app with expo cli i get the expo token . and after i generate a .aab and i post it on play store . i can't get the expo token from any device . i don't know why .
registerForPushNotification = async() => {
// Check for existing permissions
const {status} = await Permissions.getAsync(Permissions.NOTIFICATIONS);
let finalStatus = status;
// if no existing permission, ask user for permission
if (status !== 'granted') {
const {status} = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}
// if no permission, exit the function.
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!')
return;}
// get push notification token.
let token = await Notifications.getExpoPushTokenAsync();
alert(token)
firebase.database().ref('/users/usersInfo/'+user).update({
expoToken:token
})
if (Platform.OS === 'android') {
Notifications.createChannelAndroidAsync('default', {
name: 'default',
sound: true ,
priority: 'max',
vibrate: [0, 250, 250, 250],
});
}
}