获取Onesignal用户ID的正确方法是什么?
OSPermissionSubscriptionState state = OneSignal.GetPermissionSubscriptionState();
extraMessage = " UserId: "+state.subscriptionStatus.userId;
此方法对我来说有点奇怪,因为ID到达时没有调度事件。如何确定该应用程序已经具有ID?
答案 0 :(得分:1)
我找到了。
OneSignal.subscriptionObserver += OneSignal_subscriptionObserver;
private void OneSignal_subscriptionObserver(OSSubscriptionStateChanges stateChanges)
{
extraMessage = "OneSignal_subscriptionObserver UserId: " + stateChanges.to.userId;
}