Get device token in standalone app

I am trying to integrate push notification in my standalone app. I am getting error message as **getdevicepushtokenasync() exists in module exponent notifications but only one callback may be registered to a function in a native module**. I need to use SNS. So I need get the devicetoken not the expo token. Can someone help me to figure-out the issue.

const { status: existingStatus } = await Permissions.getAsync(
Permissions.NOTIFICATIONS
);
let finalStatus = existingStatus;
if (finalStatus !== “granted”) {
return;
}
const [expoToken, deviceToken] = await Promise.all([
Notifications.getExpoPushTokenAsync(),
Notifications.getDevicePushTokenAsync({ gcmSenderId: “ID” })
]);

Hey @bala342,

If you don’t need(or want) the Expo push token, why are you calling getExpoPushTokenAsync? Can you try running const deviceToken = await Notifications.getDevicePushTokenAsync(config)?

Cheers,
Adam

Thanks @adamjnav, I have tried that. But i got same error. Whenever i’m trigger the getDevicePushTokenAsync function i’m getting the error message as

getdevicepushtokenasync() exists in module exponent notifications but only one callback may be registered to a function in a native module

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