[转]com.devicepush.cordova-phonegap Device Push Notification Plugin
本文转自:https://www.npmjs.com/package/com.devicepush.cordova-phonegap
Device Push Notification Plugin
DESCRIPTION
This plugin is for use with Cordova, and allows your application to receive push notifications on Android and iOS devices.
- The Android implementation uses Google's GCM (Google Cloud Messaging) service.
- The iOS version is based on Apple APNS Notifications.
Important - Push notifications are intended for real devices. The registration process will fail on the iOS simulator. Notifications can be made to work on the Android Emulator, however doing so requires installation of some helper libraries, as outlined here, under the section titled "Installing helper libraries and setting up the Emulator".
Contents
Automatic Installation
Below are the methods for installing this plugin automatically using command line tools. For additional info, take a look at the Plugman Documentation and Cordova Plugin Specification.
This requires phonegap/cordova 5.0+
Supported Platforms
- Android
- iOS
Platforms Under Development
- WP8
Cordova and PhoneGap CLI
The plugin can be installed via the Cordova command line interface:
Navigate to the root folder for your phonegap project.
Run the command:
or
PhoneGap Build Support
The plugin can be installed via PhoneGap Build:
Open config.xml file of your project.
Add this line:
If you want to specify a particular version of the plugin you can add the version attribute to the gap tag.
Plugin API
Whitelist
Add *.devicepush.com domain in the config.xml file:
To register a new device
When the device is ready, you must call the register function.
To get id or token device
You can get the device id or token of the device.
With this ID you can send notification from your server.
To manager a notification received
You can manage notifications received with the next method
To show a dynamic and floating notification, you have to add the following function into the function successNotificationReceived.
To activate or not gps position record
You can activate or deactivate gps position record.
To put additional user data for segmentation
To activate the segmentation of notifications, you will have to send additional user data, such as personal data.
You can see more information about this at: http://www.devicepush.com/documentation-push-notification/
Looking at the above message handling code for Android, a few things bear explanation. Your app may receive a notification while it is active (INLINE). If you background the app by hitting the Home button on your device, you may later receive a status bar notification. Selecting that notification from the status will bring your app to the front and allow you to process the notification (BACKGROUND). Finally, should you completely exit the app by hitting the back button from the home page, you may still receive a notification. Touching that notification in the notification tray will relaunch your app and allow you to process the notification (COLDSTART). In this case the coldstart flag will be set on the incoming event. You can look at the foreground flag on the event to determine whether you are processing a background or an in-line notification. You may choose, for example to play a sound or show a dialog only for inline or coldstart notifications since the user has already been alerted via the status bar.
Since the Android notification data models are much more flexible than that of iOS, there may be additional elements beyond message. You can access those elements and any additional ones via the payload element. This means that if your data model should change in the future, there will be no need to change and recompile the plugin.
Testing
The notification system consists of several interdependent components.
[转]com.devicepush.cordova-phonegap Device Push Notification Plugin的更多相关文章
- [Phonegap+Sencha Touch] 移动开发77 Cordova Hot Code Push插件实现自己主动更新App的Web内容
原文地址:http://blog.csdn.net/lovelyelfpop/article/details/50848524 插件地址:https://github.com/nordnet/cord ...
- iOS上简单推送通知(Push Notification)的实现
iOS上简单推送通知(Push Notification)的实现 根据这篇很好的教程(http://www.raywenderlich.com/3443/apple-push-notification ...
- Send push notification on Apple (APNS) on c#.net
原文: http://apns-c-sharp-net-vikram-jain.blogspot.com ======================= Please, Install your ce ...
- 远程通知APNs(Apple Push Notification Server)
推送通知是由应用服务提供商发起的,通过苹果的APNs(Apple Push Notification Server)发送到应用客户端.下面是苹果官方关于推送通知的过程示意图: 推送通知的过程可以分为以 ...
- apple 官方文档 Push Notification Programming
iOS Developer LibraryDeveloper Search Local and Push Notification Programming Guide PDF Table of Con ...
- push notification for iphone
由于公司业务需求,以前一直做PHP开发,突然让我研究push notification ,一下子迷糊啦,不知所措,抓狂!但是在自己的努力下还是初有成效!现拿出来显摆一下! 1:push notific ...
- Provider Communication with Apple Push Notification Service
This chapter describes the interfaces that providers use for communication with Apple Push Notificat ...
- (转)How to build an Apple Push Notification provider server (tutorial)
转自:https://blog.serverdensity.com/how-to-build-an-apple-push-notification-provider-server-tutorial/ ...
- (转)Apple Push Notification Services in iOS 6 Tutorial: Part 2/2
转自:http://www.raywenderlich.com/32963/apple-push-notification-services-in-ios-6-tutorial-part-2 Upda ...
随机推荐
- js 小数[非]四舍五入
1.四舍五入 (2.678).toFixed(2) // 2.68 2.不需要四舍五入 (parseInt(2.678*100)/100.0).toFixed(2) // 2.67 3.字节单位转换 ...
- angular源码分析:angular中jqLite的实现——你可以丢掉jQuery了
一.从function JQLite(element)函数开始. function JQLite(element) { if (element instanceof JQLite) { //情况1 r ...
- ie8不兼容rgba的解决
借鉴................. 在调试ie8兼容性的问题时,发现ie8不支持rgba. 关于rgba(),即为颜色设置的方法函数,rgb代表颜色,a代表透明度. 如rgba(0,0,0,0.1 ...
- SAP/SD - 做SD你要知道的透明表
一.客户主数据基本数据放在KNA1里:公司代码放在KNB1里:销售视图放在KNVV里:合作伙伴放在KNVP里:二.信用主数据KNKK里有信贷限额.应收总额.特别往来:S066里是未清订单值:S067里 ...
- ae专题图
点密度图.分层设色图/等级图.单值图.柱状图.饼状图的实现代码 C# private void 点密度图ToolStripMenuItem_Click(object sender, EventArgs ...
- CALayer 易混淆的两个属性 - position和anchorPoint
1.简单介绍 CALayer有2个非常重要的属性:position和anchorPoint @property CGPoint position; ...
- LBS上传到百度地图
准备: 第一步:注册百度地图开发者账号 第二步:使用开发者账号注册相对应秘钥 在LBS后台添加所需要上传的字段 1,添加WebClientHelper帮助类 2,LBS帮助类 private stri ...
- 【VLC-Android】LibVLC API简介(相当于VLC的MediaPlayer)
前言 学新东西API很重要,这里抛砖引玉整理了一下,欢迎反馈! 声明 欢迎转载,但请保留文章原始出处:) 博客园:http://www.cnblogs.com 农民伯伯: http://over14 ...
- 网络请求之JSON解析
<一>JSON的基本知识 什么是JSON:JSON的全称是JavaScript Object Notation(JavaScript对象符号),是目前使用最广泛的数据交换格式,具有跨平台. ...
- 哭瞎!360云盘将关停,你的几十T照片和文件该怎么办
IDO老徐刚得到了一个非常不开心的消息,360云盘将停止个人云盘服务...进行业务转型,在网盘存储.传播内容的合法性和安全性得到彻底解决之前不再考虑恢复,之后转型企业云服务. 而且之前共享的所有资料, ...