• <small id='2lu6V'></small><noframes id='2lu6V'>

      <legend id='2lu6V'><style id='2lu6V'><dir id='2lu6V'><q id='2lu6V'></q></dir></style></legend>
      <tfoot id='2lu6V'></tfoot>

      1. <i id='2lu6V'><tr id='2lu6V'><dt id='2lu6V'><q id='2lu6V'><span id='2lu6V'><b id='2lu6V'><form id='2lu6V'><ins id='2lu6V'></ins><ul id='2lu6V'></ul><sub id='2lu6V'></sub></form><legend id='2lu6V'></legend><bdo id='2lu6V'><pre id='2lu6V'><center id='2lu6V'></center></pre></bdo></b><th id='2lu6V'></th></span></q></dt></tr></i><div id='2lu6V'><tfoot id='2lu6V'></tfoot><dl id='2lu6V'><fieldset id='2lu6V'></fieldset></dl></div>
        • <bdo id='2lu6V'></bdo><ul id='2lu6V'></ul>

        如何使用phonegap和解析发送推送通知

        how to send push notification using phonegap and parse(如何使用phonegap和解析发送推送通知)
          <bdo id='SkR5L'></bdo><ul id='SkR5L'></ul>

              <tfoot id='SkR5L'></tfoot>

            1. <i id='SkR5L'><tr id='SkR5L'><dt id='SkR5L'><q id='SkR5L'><span id='SkR5L'><b id='SkR5L'><form id='SkR5L'><ins id='SkR5L'></ins><ul id='SkR5L'></ul><sub id='SkR5L'></sub></form><legend id='SkR5L'></legend><bdo id='SkR5L'><pre id='SkR5L'><center id='SkR5L'></center></pre></bdo></b><th id='SkR5L'></th></span></q></dt></tr></i><div id='SkR5L'><tfoot id='SkR5L'></tfoot><dl id='SkR5L'><fieldset id='SkR5L'></fieldset></dl></div>
              <legend id='SkR5L'><style id='SkR5L'><dir id='SkR5L'><q id='SkR5L'></q></dir></style></legend>
              • <small id='SkR5L'></small><noframes id='SkR5L'>

                    <tbody id='SkR5L'></tbody>
                  本文介绍了如何使用phonegap和解析发送推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 php、jquery 和 phonegap 创建一个 android 应用程序.我在谷歌搜索了很多东西,但我找不到发送推送通知.我见过这个 Phonegap and Parse.com Push Notifications IOS 但我我不清楚我可以获取 deviceToken.

                  I am creating an android app using php,jquery and phonegap. I have searched so many things in google but i cant find to send push notification. I have seen this Phonegap and Parse.com Push Notifications IOS But i am not clear ho can i get deviceToken.

                  我也看过下面的

                  https://parse.com/questions/php-rest-example-of-targeted-push

                  我了解如何发送通知.但是没有设备令牌我怎么能发送推送通知.谁能告诉我如何获得设备令牌.

                  I understood how to send notification. But without devicetoken how can i send push notification. Can anybosy tell me how can i get the device token.

                  推荐答案

                  我关注了 本教程 直接有效.它还解释了如何获取设备令牌.

                  I followed this tutorial which worked very well directly. It also explains how to get the device token.

                  它会提醒您输入,但您也可以将手机连接到计算机并阅读 logcat 文件.(可以使用android SDK中的监控"工具)

                  It is alerted for you to type it over, but you can also hook your phone up to your computer and read the logcat files. (You can use the "monitor" tool in the android SDK)

                  更新示例

                  大多数步骤基本上是我之前提到的 devgirls 教程

                  在 Windows 命令提示符下:

                  In windows command prompt:

                  1. phonegap 创建快速推送
                  2. cd quickpush
                  3. phonegap 本地构建 android
                  4. phonegap 本地插件添加 https://github.com/phonegap-build/PushPlugin

                  我跳过了这个,我没有将文件复制到 www 目录.我只是把它留在原处.

                  I skipped this, I dont copy the file to the www dir. I just leave it where it is.

                  添加到 index.html

                  add <script type="text/javascript" src="PushNotification.js"></script> to index.html

                  添加<gap:plugin name="com.phonegap.plugins.pushplugin"/> 到config.xml(这与站点不同,解决了不支持的错误)

                  add <gap:plugin name="com.phonegap.plugins.pushplugin" /> to config.xml (this is different from site and solves not supported error)

                  复制/js/index.js文件中onDeviceReady函数中的推送代码.显然从谷歌添加你自己的密钥

                  Copy the push code in the onDeviceReady function in /js/index.js file. Obviously add your own key from google

                  alert('device ready');
                  try {
                      var pushNotification = window.plugins.pushNotification;
                      pushNotification.register(app.successHandler, app.errorHandler,{"senderID":"--SENDER ID FROM GOOGLE--","ecb":"app.onNotificationGCM"});
                  } catch (ex) {
                      alert('error: ' + ex);
                  }
                  

                • 复制/js/index.js文件中的回调处理函数

                • Copy the callback handler function in /js/index.js file

                  successHandler: function(result) {
                      alert('Callback Success! Result = '+result)
                  },
                  errorHandler:function(error) {
                      alert(error);
                  },
                  onNotificationGCM: function(e) {
                      switch( e.event )
                      {
                          case 'registered':
                              if ( e.regid.length > 0 )
                              {
                                  console.log("Regid " + e.regid);
                                  alert('registration id = '+e.regid);
                              }
                          break;
                  
                          case 'message':
                            // this is the actual push notification. its format depends on the data     model from the push server
                            alert('message = '+e.message+' msgcnt = '+e.msgcnt);
                          break;
                  
                          case 'error':
                            alert('GCM error = '+e.msg);
                          break;
                  
                          default:
                            alert('An unknown GCM event has occurred');
                            break;
                      }
                  }
                  

                • 构建应用程序:phonegap remote build android

                  这篇关于如何使用phonegap和解析发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!
                • 相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <legend id='jOITE'><style id='jOITE'><dir id='jOITE'><q id='jOITE'></q></dir></style></legend>
                    • <bdo id='jOITE'></bdo><ul id='jOITE'></ul>

                        <tbody id='jOITE'></tbody>
                      1. <i id='jOITE'><tr id='jOITE'><dt id='jOITE'><q id='jOITE'><span id='jOITE'><b id='jOITE'><form id='jOITE'><ins id='jOITE'></ins><ul id='jOITE'></ul><sub id='jOITE'></sub></form><legend id='jOITE'></legend><bdo id='jOITE'><pre id='jOITE'><center id='jOITE'></center></pre></bdo></b><th id='jOITE'></th></span></q></dt></tr></i><div id='jOITE'><tfoot id='jOITE'></tfoot><dl id='jOITE'><fieldset id='jOITE'></fieldset></dl></div>

                        <small id='jOITE'></small><noframes id='jOITE'>

                            <tfoot id='jOITE'></tfoot>