Please provide the following:
- SDK Version: 37
- Platforms(Android/iOS/web/all):Android
I’m getting [TypeError: undefined is not an object (evaluating ‘_PushTokenManager.default.getDevicePushTokenAsync’)] error when it tries to get the user’s expo push token. And I’m also run the app on my Android device. Can anyone help me solve this issue?
import * as Notifications from "expo-notifications";
import * as Permissions from "expo-permissions";
const AppNavigator = () => {
useEffect(() => {
registerForPushNotifications();
}, []);
const registerForPushNotifications = async () => {
const permission = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (!permission.granted) {
return;
}
const token = await Notifications.getExpoPushTokenAsync();
expoPushTokensApi.register(token); // sending the token to the server
console.log(token);
};
return {}
}