问题标签 [phonegap-pushplugin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
555 浏览

javascript - 不包括 Phonegap 构建插件

我已经尝试了许多不同的文件和代码组合来让这些 phonegap 构建插件发挥作用,但到目前为止没有任何效果。

这是我认为应该工作的 index.html 的开头(除了第一个脚本之外,所有脚本都不是 phonegap 插件或与 phonegap 直接相关):

这是 config.xml

测试对象OAuth(对于oauth.io)或window.plugins.pushNotification(对于PushPlugin)是否已定义,我总是知道它们是未定义的。

在文件夹中,我将所有内容放在一起,例如:

  1. (基本文件)
    • 配置文件
    • 图标.png
    • 索引.html
  2. (特定于应用程序的文件)
    • 打印R.js
    • pushNotif.js
    • tAuth.js

(所有内容都在一个文件夹中,我只是将它们分开在列表中。)

所以它非常简单明了,就像我认为的说明一样。但是,不幸的是,它不起作用。

我尝试包含phonegap.js文件,包括cordova.js,包含文件cordova.js,并包含插件的js,但我认为它不是那样工作的,所以我提出的方式就是我认为应该是应该如何设置的。


这是我用来处理和检查 phonegap 插件 pushplugin 的脚本:

如果我包含PushNotification.js脚本,我发现window.plugins.pushNotification不是undefined. 但是,对于 phonegap 构建,我认为它可能被设计为自动包含它。如果我不手动包含它(将文件PushNotification.js从 git 存储库复制到项目文件并专门包含它),我会发现该对象未定义。但是,在 phonegap 构建仪表板中,它显示该插件确实包含在内。

0 投票
0 回答
95 浏览

android - Cordova Push Notification always giving invalid notification

In my phonegap for WP8 application , i need to achieve toast notification using cordova push plugin. Everything is ok except i am always getting same toast notification as follows.

What is the reason for this? Please help me.

0 投票
1 回答
1422 浏览

ios - 未找到适用于 iOS PhoneGap 的 PushPlugin

我刚刚使用 PhoneGap CLI安装了 PhoneGap 3.5 和PushPlugin 。我使用 PhoneGap CLI 创建了一个项目。在receivedEventindex.js 的方法中,我添加了以下几行:

这会导致 xCode 中出现以下错误:

虽然说明没有表明我需要自动安装插件,但我继续添加

到我的 config.xml 并收到相同的错误。插件版本是 2.4,我使用 iPhone 6 作为测试设备和 xCode 6。

任何想法在哪里看?

0 投票
2 回答
3338 浏览

javascript - Cordova 从推送通知检测冷启动

我有一个在 iOS 上运行的 Cordova 应用程序(codova(3.4.0),很快也在 Android 上运行。推送通知已实现并正常工作。我无法通过推送通知检测应用程序何时启动并将应用程序重定向到右侧页。

注意:这与应用在后台运行时从推送通知启动应用无关。只有当应用程序完全关闭时!

我现在有以下工作流程:

常规启动:

  • 等待 cordova.js 触发 ondeviceready 事件。
  • 在 ondeviceready 事件中重定向到我的应用程序的启动视图(通过 window.location.hash)

从推送通知冷启动应用程序:

  • 等待 cordova.js 触发 ondeviceready 事件。
  • 在 ondeviceready 事件中重定向到我的应用程序的启动视图(通过 window.location.hash)
  • 插件启动并在我的应用程序中触发一个名为 notificationreceived 的 javascript 函数
  • 在notificationreceived 函数中重定向到基于推送通知的视图

如您所见,冷应用启动场景会转到启动视图,这是不必要的,并且会导致用户等待第一个视图加载,只是再次被重定向。

问题是当 deviceready 触发时,我的 javascript 代码还不知道即将到来的推送通知,所以我正在寻找解决这个问题的方法。

有没有办法将额外的参数传递给 deviceready cordova 事件?或者有人有其他想法或解决方案来解决这个问题吗?

0 投票
1 回答
669 浏览

cordova - Cordova Pushplugin:未调用 ecb

我正在尝试检索设备注册 ID,以便从我的后端向它发送通知。

我已经尝试了几次:

  1. 在我的对象之外

  1. 方法在另一个对象内部(一切都保持不变,除了 ECB :

    /li>

这是我放置处理程序的地方:

  1. 我最后的方法

    /li>

这里添加了管理器类:

我也尝试过不使用窗口对象等。我的成功处理程序总是被触发,但从来没有被 ECB 触发。

0 投票
1 回答
822 浏览

android - PushNotification 无法在后台使用应用程序

我正在使用ionic/cordova开发一个 iOS 和 android 应用程序,并且我正在尝试使用PushPlugin库让推送通知在两个平台上都工作。

问题是我的推送通知在 iOS 上工作正常,但在 android 中发生的事情有点奇怪,当应用程序在前台时,通知成功到达,但是当应用程序在后台时(应用程序是关闭),通知永远不会到达......

对此有什么想法吗?权限

我按照本教程使 gcm 通知正常工作(我的代码类似),并且我正在使用 genymotion 测试通知。

这是我的 AndroidManifest.xml

0 投票
2 回答
2012 浏览

cordova - PushPlugin TypeError: Object # has no method ''exec

Background

  1. I installed PushPlugin. According to the docs I used autom

    Background

    1. I installed PushPlugin. According to the docs I used automatic installation. But when I run cordova run android, JavaScript returns the error, 'Cannot read property pushNotification of undefined'

    2. If I add

      then the error changes to the one in this question's title.

    3. This is how my HTML loads the scripts

      Initialization code is in index.js where after deviceready I call pushNotification.register.

      After the register completes, I call MyEmberApp.deferReadiness()

    4. After automatically installing the plugin, I just have to run register, according to the docs. But this still leads to 'Cannot read pushNotification....'

    5. It seems that PushNotification.js is automatically inserted after deviceready fires. But the plugin is not doing so. If I insert the script in index.html, the error Object has no method 'exec' occurs because deviceready hasn't fired yet.

    6. deviceready

      /li>

    Question

    What am I doing wrong? How should I do this?

    Update

    I just realized that I have only tried the automatic installation. I have not tried the manual steps. But that is no reason why the direct plugin install shouldn't work


    SQL Server After Update Trigger Not firing

    Kindly help, I have been trying to create an update trigger to insert data into a specific table once it's updated with a certain value. "Accepted". for somewhat reason the trigger is not firing

0 投票
1 回答
55 浏览

android - 我们如何在 UAPush 插件 + phonegap 的所有安装中获得相同的频道 ID

我需要通道 ID 通过 Android/iOS 中的 PhoneGap 插件发送推送通知。我能够在 iOS 中获得相同的频道 ID,但 Android 在所有重新安装时都会提供不同的频道 ID。我需要相同的 Channel-Id - 重新安装。如果有人实现它,请帮助我。非常感谢。

0 投票
0 回答
184 浏览

javascript - Phonegap : PushPlugin 徽章发布版本 2.4.0

我有推送插件版本 2.4.0 的问题在 ios 8 中,它运行良好,但在 ios 6 和 ios 7 中,徽章计数未显示。我可以在这些设备上接收推送,只是缺少徽章计数。

有趣的是,当我安装我的应用程序时,我可以在 ios 6 中看到徽章。那时,我可以看到一条附加消息,说我应该允许应用程序使用推送通知。不小心我点击了错误的按钮,推送被禁用了。后来我在设置里打开了。之后,徽章工作正常。

有人知道为什么会这样吗?任何帮助将不胜感激。

谢谢。

0 投票
1 回答
1723 浏览

android - PushPlugin 寄存器转到错误处理程序,显示“未找到类”,cordova 4.0.0 for android 平台

我正在使用适用于 Android 的 Cordova(版本 4.0.0)构建一个混合应用程序。

我已将 PushPlugin ( https://github.com/phonegap-build/PushPlugin ) 添加到项目中。注册时,它会转到错误处理程序并显示“找不到类”。

我尝试了各种建议,例如

  • 在 xml 中添加了插件引用。实际上插件参考已经存在于 config.xml 文件中。
  • 使用CLI直接安装插件(试过cordova插件添加 https://github.com/phonegap-build/PushPlugin.git以及cordova插件添加com.phonegap.plugins.pushplugin)
  • 创建一个新项目等。
  • PushNotification.js 在 html( <script type="text/javascript" src="js/PushNotification.js"></script>) 中添加,位于www/js/

但我仍然收到相同的消息“找不到类”

我已经安装了支持插件,例如 PushPlugin 使用的设备、文件、媒体

如果有人对此问题有解决方案,请提出建议。

代码示例: