Error while geeting standalone device token for push notification

#1

const { data: token, type: platform } = await Notifications.getDevicePushTokenAsync({
gcmSenderId: “XXXXXXX”,
});

when I am using this to get device token. I am getting the following error.

**

ExceptionsManager.js:63 The callback getDevicePushTokenAsync() exists in module ExponentNotifications, but only one callback may be registered to a function in a native module.

**

#2

Hi @kodandaram199, are you calling this in a standalone app or through the main Expo client? getDevicePushTokenAsync is only supported in standalone apps.

#3

Now I have got build of andriod and I am getting device token. But When I push to AWS SNS, it’s showing status as delivered but the device is not receiving the notification.

But when I try to push using EXPO token , it’s receving the notification.

Sample payload

         {
                experienceId: "12",
                title: "dsjhdhs",
                message: "sddshf",
                body: "dsnbnsdg",
            }
#4

We haven’t detached our app but when we are building the android standalone app, we are getting the device token (We are not getting this when building on expo as this is not supported if not detached).

Now we are having the device token but Notification.addListener is not receiving any notifications sent from sns but it is working perfectly with expo push server.

closed #5

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