OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
625 stars 215 forks source link

[question]: how to get playerId(userId) in this version? #794

Closed lyfer-bob closed 7 months ago

lyfer-bob commented 1 year ago

How can we help?

in old version i can get by
var status = await OneSignal.shared.getDeviceState(); var playerId = status!.userId;

but in this version can't call getDeviceState() .

Code of Conduct

salamohamad commented 11 months ago

Yes, having same issue. Just updated to ^5.0.4 but cant seem to find the player ID for internal keep

nan-li commented 11 months ago

Hi @lyfer-bob and @salamohamad, if you are looking for the push subscription ID (most equivalent to the player ID in v3.x.x), it can be retrieved via var id = OneSignal.User.pushSubscription.id.

If you are looking for the user-level onesignalId, it will be available in a future release.

masreplay commented 11 months ago

Any updates?

jennantilla commented 7 months ago

Hello everyone!

Just an update that onesignalId is now also available on the Flutter SDK.

Please upgrade to the latest Flutter SDK to use the new methods, User.getExternalId and User.getOnesignalId. Please refer to our migration guide for full details!