问题标签 [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 投票
4 回答
2887 浏览

android - 在模拟器上使用 PushPlugin 的 Android PushNotifications

我一直在关注这个示例来让 android pushNotifications(使用 GCM)在 android 模拟器上工作。在$cordovaPush.register(config)我得到 Ok 作为回应之后。但它从不运行我的回调 [ $scope.$on('$cordovaPush:notificationReceived']。结果我从来没有得到我的注册ID。

我创建了一个谷歌 API 项目。我在调用 config.senderID 时使用了该项目 ID $cordovaPush.register(config)

我还在模拟器中注册了一个 gmail 帐户。

我想我有2个问题。

1.是否可以在安卓模拟器上获取(和注册)推送通知?

  1. 为什么我没有收到调用我的回调的 $cordovaPush:notificationReceived 事件?

    app.controller('AppCtrl', function($scope, $cordovaPush, $cordovaDialogs, $cordovaMedia, $cordovaToast, ionPlatform, $http) { $scope.notifications = [];

    /li>
0 投票
1 回答
97 浏览

cordova - Cordova PushPlugin + Android 4.4 不工作?

尽我所能,但在 Android 4.4 上,我在使用 PushPlugin 时没有从 Google Cloud Messaging 获得注册 ID。

在 Android 4.2 上一切正常。我正在使用 Cordova 4.2 和 PushPlugin 2.4

也尝试过 Cordova 3.6,但在 Android 4.4 上也不起作用。

有没有人对 Android 4.4 和 PushPlugin 有过好运?

0 投票
1 回答
1736 浏览

android - Phonegap:GCM 推送通知注册调用返回正常,但设备甚至没有连接到互联网

我已按照本教程进行操作,并且有以下代码:

onDeviceReady 我执行:

处理程序:

如果我的设备在我第一次打开应用程序时连接到互联网,则此代码可以完美运行。

如果我的设备未连接,则使用“OK”调用successHandler,并且永远不会调用onNotificationGCM。这是正常的吗?

我原以为注册会失败并使用 e.event = 'error' 调用 errorHandler 或 onNotificationGCM,这样我就可以推迟注册,但这并没有发生。

我会很感激任何帮助,谢谢。

0 投票
2 回答
618 浏览

cordova - Cordova - 关闭通知将丢失其中的数据

在使用 ionic 框架和 ngCordova 插件进行开发时,我在 android 上使用 cordova 时遇到了不好的行为。使用 PushPlugin 插件,我能够使用 GCM 接收通知。当应用程序处于后台并收到通知时,我可以在不进入应用程序的情况下将其关闭,但是,当我启动应用程序时,我不知道收到(和关闭)的新数据是否有办法保留数据? 我需要它,因为它不仅是一个通知,还有我稍后需要在 UI 上显示的数据。

0 投票
0 回答
288 浏览

parse-platform - 通过 PubNub/Parse 在 Android 上没有推送通知

我被难住了。此处是 Phonegap/Mobile Dev 新手。寻求一些建议。

我有一个为 Android 和 iOS 开发的 phonegap 应用程序(带有推送插件)。我试图在 Android 上测试推送通知。我有以下流程

  1. 设备向 GCM(或 APNS)注册并将令牌发送回服务器。
  2. 在服务器端,我确定用户的身份并在 PubNub 上为他们创建一个频道。
  3. 服务器将设备连同频道一起注册到 PubNub。
  4. 我可以验证该设备已订阅了几个频道。
  5. 我从服务器端发送消息。
  6. 我在 PubNub 控制台中看到它。
  7. 但Android上没有通知。

当我尝试使用其中一项免费服务(在小提琴上找到一些 php 代码)来尝试向设备发送消息时,它可以工作。我在设备上看到通知。

我尝试直接从 PubNub 控制台发送消息,但没有成功。

注 1 - 我已经在 PubNub 上添加了 GCM API 密钥。注 2 - 我使用的是免费套餐

所以,我想,也许 PubNub 出了点问题,我转向 Parse。

我通过 curl(REST) 创建频道、注册设备和发送消息。我在解析仪表板上看到推送通知,但设备上仍然没有消息。

我还没有在 iOS 上进行测试(处理其他一些与 iOS 相关的问题)。

我已按照 PubNub 和 Parse 的教程进行操作。此时,我想知道设备本身是否需要订阅 PubNub/Parse 并且不能使用后端服务来订阅它们。

请帮忙。

0 投票
0 回答
428 浏览

android - Google Developer Console - 显示错误,我在哪里可以找到这些错误消息

首先,如果之前有人问过这个问题,或者答案很简单,我深表歉意。下图是我的谷歌开发控制台的屏幕截图。第二行有一个名为 Prospector App 的应用程序。我正在使用 gcm 向我的应用程序发送推送通知。

当我第一次创建项目并在我的 phonegap 应用程序中关联应用程序 ID 时。我能够发送和接收推送通知。但是,我只能在它们停止工作之前发送几条消息。

我仍然收到这样的成功消息

但是,设备上永远不会收到通知。发生这种情况时,我注意到开发控制台中的错误编号会增加,似乎是无限期的。我有另一个项目有超过 1k 的错误和计数。

我的问题是,这些错误消息在开发控制台中的什么位置显示?

控制台错误消息

提前感谢您的任何帮助

0 投票
1 回答
34 浏览

android - 在android中重新安装Phonegap应用程序时获取channelId不同

我正在开发具有推送通知功能的应用程序。UrbanAirship我正在获取 pushId 进行注册。在iOS中,它在重新安装应用程序时提供相同的 pushId,但在Android中,pushId 在所有重新安装时都发生了变化。我在所有重新安装时都需要相同的 pushId。

使用这行代码的插件 java 文件:-

我正在尝试使用getChannelId()方法,但它给出了no method found的错误。

我能做些什么来获得这些所需的信息。

请给我一些指导方针。

0 投票
1 回答
1297 浏览

android - How to handle unregistering of push notifications?

Owning an Ionic application (cordova), I'm using this plugin to handle pushing of notifications.

I'm confused regarding the unregister function.

Reading the official GCM documentation:

You should only need to unregister in rare cases, such as if you want an app to stop receiving messages, or if you suspect that the registration ID has been compromised. In general, once an app has a registration ID, you shouldn't need to change it.

For those reasons:

  • A registration ID isn't associated with a particular logged in user. If you unregister and then re-register, GCM may return the same ID or a different ID—there's no guarantee either way.
  • Unregistration may take up to 5 minutes to propagate.
  • After unregistration, re-registration may again take up to 5 minutes to propagate. During this time messages may be rejected due to the state of being unregistered, and after all this, messages may still go to the wrong user.

So I wonder why there is the functionality of unregistering client if this is really not recommended.

Indeed, logically, by reading that, I think about implementing a custom unregister function at client side like the following pseudo-code:

=> no need to unregister the client itself.

Indeed, as it exists a mapping on the server database between registrationId and userId, by just emptying the registrationId value, no message would be sent to the client any more; what is expected.
Therefore, the only way to expect notifications again would be to let the client register again.

So, I repeat, what is the need/use case of unregistering the client itself?

It's really not clear.

0 投票
1 回答
1480 浏览

cordova - 如何在firebase中处理推送通知

我正在使用 firebase 和 phonegap 开发一个实时聊天应用程序,我需要在应用程序未运行时处理推送通知。请指导我在后端服务器上处理推送通知以进行 firebase 更改。

谢谢

0 投票
1 回答
730 浏览

javascript - 如何将解码后的数据从json存储到sqlite

我想解码来自我的网站的 json 数据到应用程序。该应用程序是使用 phonegap 构建的。消息通过 GCM 发送到应用程序,但显示“未定义”。我不知道解码消息。

这是 js 中的函数:

这里的 e.payload.message 是要解码并存储到 SQLite 数据库中的项目。

当我使用 stringify 时,我得到了解码的数据。这是解码的数据

这是我得到的回应。

现在我想知道如何使用 sqlite 将其存储在数据库中。?

谢谢你。