Push notification and Location not working after build

I am using below code for getting location. Its work perfectly in expo client app. but after build in android its doesn’t work. Its ask for permission but after giving permission doesnt response anything in build app. Same issue expo push notification its work perfectaly in Expo client app not work in build.

Is there anything need to define in app.json for Notification and Location

Location code

const { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
     showMessage('Permission to access location was denied');
}
    let location = await Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.High });

Notification code

const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
    let finalStatus = existingStatus;
    if (existingStatus !== 'granted') {
      const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
      finalStatus = status;
    }
    if (finalStatus !== 'granted') {
      showMessage('Failed to get push token for push notification!');
      return;
    }

app.json code of android permission

“android”: {
“package”: “com.xyz.app”,
“versionCode”: 4,
“permissions”: [
“CAMERA”,
“VIBRATE”,
“ACCESS_COARSE_LOCATION”,
“ACCESS_FINE_LOCATION”
]
},

O problema ocorre pois o expo mudou a forma a forma de notificação, agora é necessário criar um projeto no firebase para o seu projeto para daí ser possível enviar notificações.

Nesse link é apresentado o passo a passo a ser feito:
https://docs.expo.io/guides/using-fcm/

1 Like

Thanks a lot. After configured with FCM now its working fine.

Do you have any solution for location?

Sinto muito, porém não tenho, este problema ainda não enfrentei.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.