Open rikinshah23 opened 1 month ago
Experiencing the same thing with 5.1.3
and the latest release 5.2.0
. Works fine with 5.1.0
.
Hi @rikinshah23 and @wneild are you seeing this on both iOS and Android?
Experiencing the same thing with 5.2.0
on android. It seems to work fine on iOS.
Also I reverted back to 5.0.0 and using the sync
version of the API , I also cannot see the notificationId anymore.
same issue here with latest releases. any updates on this?
Same issue here with 5.2.1
. This is my code:
useEffect(() => {
const initialize = async () => {
// OneSignal Initialization
OneSignal.initialize(Constants.expoConfig.extra.oneSignalAppId);
OneSignal.Notifications.requestPermission(true);
console.log("requestPermission:");
OneSignal.Notifications.addEventListener("click", (event) => {
console.log("OneSignal: notification clicked:", event);
});
OneSignal.Notifications.addEventListener("foregroundWillDisplay", (event) => {
event.getNotification().display();
});
OneSignal.Notifications.addEventListener("permissionChange", (granted) => {
console.log("OneSignal: permission changed:", granted);
fetchAndSendSubscriptionInfo();
});
const fetchAndSendSubscriptionInfo = async () => {
try {
const subId = await OneSignal.User.pushSubscription.getIdAsync();
console.log("subId:", subId); // <----- here I get null
if (subId) await updateSubscriptionToken(subId);
} catch (error) {
console.error("Error fetching subscription info:", error);
}
};
fetchAndSendSubscriptionInfo();
};
initialize();
}, []);
How can we help?
I am using version
"react-native-onesignal": "^5.1.3",
Initializing the OneSignal SDK in App.js in my React-native application like so:
I am using
getIdAsync
andgetOnesignalId
functions and it always returning nullhasOptedIn
always comes astrue
so that part is working.getTokenAsync
also returns the value.Code of Conduct