Expo SDK 42 Android push notification permission request not work

Please provide the following:

  1. SDK Version: 42.0.0
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

This is my code parts

async function registerForPushNotificationsAsync(deviceKey) {

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('Bildirim İzni Alınamadı. Bildirim almak için ayarlardan izin veriniz.');
        return;
    }

    token = (await Notifications.getExpoPushTokenAsync()).data;

    let formData = new FormData();
    formData.append('secret', "xxxx");
    formData.append('device', Platform.OS);
    formData.append('token', token);
    formData.append('track',deviceKey);

    fetch("https://xxxxx/app/plugin/xxxxx/register", {
            body: formData,
            method: "post"
        })
        .then(response => response.json())
        .then(data => { });

} else {
    alert('Fiziksel Cihaz Desteklemektedir.');
}

if (Platform.OS === 'android') {
    await Notifications.setNotificationChannelAsync('default', {
        name: 'default',
        importance: Notifications.AndroidImportance.MAX,
        vibrationPattern: [0, 250, 250, 250],
        lightColor: '#FF231F7C',
    });
}

return token;

}

IOS is working notification permission request is work. But android is not work norification permission request.

how can i do ?

Hey @cengizakcan, can you ensure you’ve followed all the necessary steps to configure FCM for android notifications? Also, let me know what device(s) you are encountering this issue on.

Cheers,
Adam

1 Like

Hey @adamjnav thank you for your answer. I thought of the steps related to FCM as optional, but after reading the documentation, I saw that FCM is mandatory for android. I’ve done my tests. It works fine, only the icon does not appear.

If the icon isn’t appearing properly, you should refer to this item in the notifications FAQ

Thanks for all to expo team.

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