1

我正在使用 Urbanairship 和 Phonegap。推送消息在许多情况下都可以正常工作,但我在客户端捕获“APID”时遇到问题。设备已注册并生成 APID,但是当我尝试在 javascript 中调用 registerEvent 时,推送对象为空且未调用该函数。

push = window.pushNotification; //this returns an object
push.registerEvent('registration', function (error, id) {//this is never fired   

我正在使用 PhoneGap 2.9

//在config.xml中

<plugin name="PushNotificationPlugin" value="com.urbanairship.phonegap.plugins.PushNotificationPlugin" onload="true"/>

如果我从 logcat(eclipse) 复制 APID 并使用它,则消息传递正在工作。唯一的问题是我无法在客户端获取 APID

请帮忙

4

1 回答 1

0

您需要使用 Phonegap 3.0,如Github 页面所述,如果您查看Example/index.html,您可以看到他们使用以下方式获取推送对象:

var push = window.plugins.pushNotification;

然后 push.registerEvent('registration', callback) 应该可以工作。

于 2013-09-04T15:09:13.010 回答