首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android和Phonegap中推送通知

在Android和Phonegap中推送通知
EN

Stack Overflow用户
提问于 2012-11-17 06:22:21
回答 2查看 4.8K关注 0票数 2

我正在搜索Android应用程序中的推送通知。我检查了"Pushwoosh":在initPushwoosh方法中,我看到了GOOGLE_PROJECT_IDPUSHWOOSH_APP_ID

代码语言:javascript
复制
function initPushwoosh() {
  var pushNotification = window.plugins.pushNotification;
  pushNotification.registerDevice(
    {
      projectid: "GOOGLE_PROJECT_ID",
      appid : "PUSHWOOSH_APP_ID"
    },
    function(status) {
      var pushToken = status;
      console.warn('push token: ' + pushToken);
    },
    function(status) {
      console.warn(JSON.stringify(['failed to register ', status]));
    }
  );
  document.addEventListener('push-notification', function(event) {
    var title = event.notification.title;
    var userData = event.notification.userdata;
    if(typeof(userData) != "undefined") {
      console.warn('user data: ' + JSON.stringify(userData));
    }
    navigator.notification.alert(title);
  });
}

我怎么才能拿到这两个身份证?或者有什么更好的方法来做这件事?

我在PhoneGap文档中看到了通知,它是推送通知吗?

谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-11-17 23:24:15

Phonegap的通知与推送通知无关。在这里查看:notification.md.html#Notification

要将Pushwoosh与Phonegap集成起来,请查看手册:http://www.pushwoosh.com/programming-push-notification/android-gcm-push-notifications-guide/

在本页中有更多关于使用Pushwoosh的指南:

http://www.pushwoosh.com/programming-push-notification/

祝你好运!

票数 2
EN

Stack Overflow用户

发布于 2012-11-18 11:29:33

以下是您必须执行的步骤:

  1. 首先,必须在Google站点注册,选择“服务:https://code.google.com/apis/console/
  2. 打开Google消息传递开关
  3. 在“服务术语”页面中,接受创建服务器密钥所需的terms.Now
  4. 按“API Access”按钮
  5. 按“创建新服务器键”。服务器键或浏览器键都应该工作。使用服务器密钥的优点是它允许您白名单IP地址。
  6. 按“创建”。
  7. 您可以在Google控制台的URL中找到您的GOOGLE_PROJECT_ID。通常如下所示:本例中的https://code.google.com/apis/console/#project:12345678912:access是: 12345678912
  8. 输入Pushwoosh:https://cp.pushwoosh.com/
  9. My Apps菜单中创建或输入
  10. 当您进入一个应用程序时,您将在该页面或导航器的url中看到应用程序代码,这将是您的PUSHWOOSH_APP_ID
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13428272

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档