Firstly i will be really appreciated for your helps.
I'am trying to implement expo push notification using expo-bare workflow. When i run app, it gives me error like this so i could not get token.
error [TypeError: null is not an object (evaluating '_ExponentNotifications.default.getExponentPushTokenAsync')]
Here is my code:
import { Notifications } from "expo";
import * as Permissions from "expo-permissions";
import Constants from "expo-constants";
export const getToken = async () => {
if (Constants.isDevice) {
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") {
console.log("Failed to get push token for push notification!");
return;
}
token = await Notifications.getExpoPushTokenAsync();
}
else {
console.log("Must use physical device for Push Notifications");
}
return token;
};