我正在尝试将OneSignal初始化为PhoneGap应用程序。
我试过很多种方法。但它总是会产生以下错误,
Uncaught :无法读取属性'OneSignal‘的未定义“,源:OneSignal错误。
这是我的app.js文件
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
oneSignal();
checkConnection();}
function oneSignal(){
console.log("It is calling");
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init("my app id",
{googleProjectNumber: "my project number"},
notificationOpenedCallback);
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);}请帮助我将OneSignal初始化为我的PhoneGap应用程序。
发布于 2016-04-18 09:25:20
只要试着安装你的插件,交叉验证它在plugins文件夹中的可用性。另外,确认在config.xml和fetch.json (插件文件夹中)中已经进行了相应的更新。如果插件安装不当,通常会出现错误。
希望这能帮上忙。:)
发布于 2016-05-27 10:34:00
初始化OneSignal的最好方法是在controller.js文件中添加代码,并确保它位于一个控制器中--它可能是登录、注销或任何东西。
换句话说,您需要在响应特定操作的集合控制器中添加代码。
无法更好地解释它,但是尝试一下-..。
祝好运
https://stackoverflow.com/questions/36687064
复制相似问题