Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i am using in my react native app onesignal version 4.5.0 but onesignal's update their version with 5.0.0 know i did not get OneSignal.getDeviceState() function because they change their functions , this function is not recongnized in new new version how i get DeviceState]: #1562

Closed
1 task done
MuhammadAkbar6722 opened this issue Sep 20, 2023 · 7 comments

Comments

@MuhammadAkbar6722
Copy link

MuhammadAkbar6722 commented Sep 20, 2023

How can we help?

OneSignal.Debug.setLogLevel(LogLevel.Verbose);

// OneSignal Initialization
OneSignal.initialize("key")

OneSignal.Notifications.requestPermission(true);

// Method for listening for notification clicks
OneSignal.Notifications.addEventListener('click', (event) => {
console.log(event , "LLLLLL")
console.log('OneSignal: notification clicked:', event);
})

Code of Conduct

  • I agree to follow this project's Code of Conduct
@VenkateshhDasari
Copy link

yes for me also i am not able to get that function any one please help

@MehmetDT
Copy link

me too

@Romick2005
Copy link

But you do not mention what data do you need? Except the fact that function is missing (removed).

@nan-li
Copy link
Contributor

nan-li commented Sep 20, 2023

Hi @MuhammadAkbar6722, the general getDeviceState() method has been removed and the information has been split across namespaces.

What information are you looking for?

Please see the migration guide for all the methods and information you can retreive on the 5.0.0 major release.

@FazilMuhammed
Copy link

FazilMuhammed commented Oct 11, 2023

Initially tokens, id not getting.if any changes made in code and save then only values getting.please help to get automatically value gets initially app open

@nan-li
Copy link
Contributor

nan-li commented Oct 23, 2023

Hi @FazilMuhammed,
If you are looking for the current device’s push subscription, information can be retrieved via:

const id = OneSignal.User.pushSubscription.getPushSubscriptionId();
const token = OneSignal.User.pushSubscription.getPushSubscriptionToken();
const optedIn = OneSignal.User.pushSubscription.getOptedIn();

@MattFixesFaults
Copy link

You find a conversion of old v4 to v5 functions in their quite hidden migration doc:
https://github.com/OneSignal/react-native-onesignal/blob/major_release_5.0.0/MIGRATION_GUIDE.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants