OneSignal科尔多瓦

时间:2018-06-26 18:03:36

标签: cordova cordova-plugins phonegap-plugins onesignal

我在Cordova中使用OneSignal,并且有一个特殊的用例。我的问题是如何两次或多次调用Init方法,以便为用户/设备预订不同的帐户(当然是在运行时)。在我的情况下,首次初始化在DeviceReady中工作正常,但是如果我从JS调用另一个具有不同的onesignal项目ID的初始化,则无法正常工作。我该如何实现?我想我也必须修改Java代码... 我试图寻求支持,但到目前为止没有什么特别的。。谢谢。 像这样:

onDeviceReady (){
//This works ..
window.plugins.OneSignal
.startInit("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();

//Get Player ID...
}

...

function Resgister() {
//This wont work

    window.plugins.OneSignal
    .startInit("yyyyyyyy-yyyy-yyyy-yyy-yyyyyyyyyyyy")
    .handleNotificationOpened(notificationOpenedCallback)
    .endInit();

//Get the other Player id from the other account...
}``

0 个答案:

没有答案