Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
jpush-phonegap-plugin
Advanced tools
支持 iOS, Android 的 Cordova 推送插件。
如需要 IM 功能插件,请关注 jmessage-phonegap-plugin。
cordova create 文件夹名字 包名 应用名字
cordova create Myproj com.myproj.jpush MyTestProj
添加平台:
cd Myproj
cordova platform add android
cordova platform add ios
ps: 这里请注意iOS平台,必须先执行 cordova platform add ios,
然后再执行 cordova plugin add xxxxx 命令,不然有一些必须要的链接库需要手动添加。
安装 JPush PhoneGap Plugin 有两种方法:
方法一:在线安装
通过 cordova plugins 安装,要求 phonegap/cordova CLI 5.0+:
cordova plugin add jpush-phonegap-plugin --variable API_KEY=your_jpush_appkey
直接通过 url 安装:
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git --variable API_KEY=your_jpush_appkey
方法二:下载到本地再安装
使用 git 命令将 JPush PhoneGap 插件下载的本地,目录标记为 $JPUSH_PLUGIN_DIR。
git clone https://github.com/jpush/jpush-phonegap-plugin.git
cordova plugin add $JPUSH_PLUGIN_DIR --variable API_KEY=your_jpush_appkey
cordova plugin add cordova-plugin-device
//由于 PhoneGap 插件采用了 Lazy load 的特性,所以建议在 js 文件能执行的最开始就添加
window.plugins.jPushPlugin.init();
插件中包含示例 Demo。若想参考,可以在 $JPUSH_PLUGIN_DIR/example 文件夹内找到并拷贝以下文件:
src/example/index.html -> www/index.html
src/example/css/* -> www/css
src/example/js/* -> www/js
该项目基于 cordova 实现,目前无法使用 PhoneGap build 云服务进行打包,建议使用本地环境进行打包。
插件的 API 集中在 JPushPlugin.js 文件中,该文件的具体位置如下:
Android:
[Project]/assets/www/plugins/cn.jpush.phonegap.JPushPlugin/www
iOS:
[Project]/www/plugins/cn.jpush.phonegap.JPushPlugin/www
若要使用 CLI 来编译项目,注意使用 cordova compile 而不是 cordova build,因为 cordova build 会清除对插件文件的修改。 具体 cordova CLI 用法可参考cordova CLI 官方文档。
eclipse 中 import PhoneGap 工程之后出现:Type CallbackContext cannot be resolved to a type
。
解决方案:eclipse 中右键单击工程名,Build Path -> Config Build Path -> Projects -> 选中工程名称 -> CordovaLib -> 点击 add。
收不到推送:
请首先按照正确方式再次配置证书、描述文件 iOS 证书设置指南
设置 PushConfig.plist:
如有问题可访问极光社区
FAQs
JPush for cordova plugin
The npm package jpush-phonegap-plugin receives a total of 35 weekly downloads. As such, jpush-phonegap-plugin popularity was classified as not popular.
We found that jpush-phonegap-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.