Advanced reactnative push token not log on on the console

Please help i have been struggling with how to get the push token for days now but all to no avail.

here is my code

import React, { useEffect } from “react”;

import { createBottomTabNavigator } from “@react-navigation/bottom-tabs”;

import { MaterialCommunityIcons } from “@expo/vector-icons”;

import ListingsEditScreen from “…/screens/ListingsEditScreen”;

import FeedNavigator from “./FeedNavigator”;

import AccountNavigator from “./AccountNavigator”;

import NewListingButton from “./NewListingButton”;

import * as Permissions from “expo-permissions”;

import * as Notifications from “expo-notifications”;

const Tab = createBottomTabNavigator();

const AppNavigator = () => {

useEffect(() => {

registerForpushNotification();

}, []);

};

const registerForpushNotification = async () => {

try {

const permission = await Permissions.askAsync(Permissions.NOTIFICATIONS); // permission granted only once

if (!permission.granted) return;

const token = await Notifications.getExpoPushTokenAsync(); //get notification token

console.log(token);

} catch (error) {

console.log("error getting push token", error);

}

Is anything being logged by your console.log statements? What if you put a console.log at the top of your registerForpushNotification function, does it get logged?

yes i logged the token on the console

see here i extracted this line from the code above:
that is the line to get the token

const token = await Notifications.getExpoPushTokenAsync(); //get notification token

console.log(token);

But the token isn’t being logged? What if you add a console.log('test') at the top of your registerForpushNotification function, do you see test in the ouput?

thanks i think i got it now however the package is deprecated