简体   繁体   English

使用Onesignal错误推送通知

[英]push notification using Onesignal error

while trying to create a push Notification using GCM Per device or a group of devices - we are trying to use Onesignal for registration of our android users and getting an undefined error. 尝试使用每台设备或一组设备的GCM创建推送通知时-我们正尝试使用Onesignal来注册我们的android用户并收到未定义的错误。 the code is written on JS and then build using Phonegap and realesed as an APK for android, while debugging it we get "windwos.onesignal undefined" any lead or help would be appriciated Thank you (can't post the Chrome debugger message rep 10 is requered :-) ) 该代码是用JS编写的,然后使用Phonegap构建并重新实现为适用于Android的APK,在调试它时,我们得到“ windwos.onesignal undefined”,因此任何线索或帮助都将得到感谢(无法发布Chrome调试器消息代表10要求:-))

Is windwos.onesignal exactly what you have in your code? windwos.onesignal正是您的代码中所包含的吗? Or is this a typo in your post? 还是这是您帖子中的错字?

All calls to OneSignal should be called by with window.plugins.OneSignal . 所有对OneSignal的调用都应通过window.plugins.OneSignal来调用。

Example: window.plugins.OneSignal.sendTag("key1", "value1"); 示例: window.plugins.OneSignal.sendTag("key1", "value1");

Check to make sure window.plugins is defined where you're calling OneSignal. 检查以确保在调用OneSignal的位置定义了window.plugins It should be called from your onDeviceReady function or add a 'deviceready' listener if you don't have this function. 应该从onDeviceReady函数中调用它,或者如果没有此函数,则添加一个“ deviceready”侦听器 Double check your code with OneSignal's Cordova/PhoneGap install instructions . 使用OneSignal的Cordova / PhoneGap安装说明仔细检查您的代码。

You can also send your APK to support@onesignal.com and we can help debug your issue. 您也可以将APK发送至support@onesignal.com,我们可以帮助您调试问题。

Follow the documentation here Make sure you add plugin 请遵循此处的文档确保您添加了插件

> cordova plugin add onesignal-cordova-plugin

And try building it locally. 并尝试在本地构建它。

>ionic build android

If it works locally there is some issue with you config file.Specify version of plugin in config file. 如果它在本地工作,则说明您的配置文件存在问题。在配置文件中指定插件的版本。 Check your installed plugin version. 检查您安装的插件版本。

  <plugin name="com.onesignal.plugins.onesignal" spec="1.9.0" source="pgb" />

Hope this helps ! 希望这可以帮助 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM