[转]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 ...
随机推荐
- scrollify.js 鼠标滚动
在线实例 实例演示 使用方法 <! doctype html> <html> <head> <script> $(function() { $.scro ...
- 关于HTML面试题汇总之visibility
一.页面可见性(visibility) 主要提供两个属性,一个事件(都在document对象上):1. 属性: 1.1. hidden:获取或设置当前页面的可见性,boolean值: 1.2 ...
- 为Titanium创建自己的安卓推送模块
在手机应用中,推送是一个非常重要的功能.相对来说ios应用的推送功能很容易做,因为它统一都是用苹果的APNS服务实现的.但安卓这边就比较混乱了,虽然谷歌也推出了类似苹果的官方推送服务,但由于谷歌的服务 ...
- scroll事件实现监控滚动条并分页显示示例(zepto.js)
scroll事件实现监控滚动条并分页显示示例(zepto.js ) 需求:在APP落地页上的底部位置显示此前其他用户的购买记录,要求此div盒子只显示3条半,但一页有10条,div内的滑动条滑到一页 ...
- 探究TCP
OSI OSI是Open System Interconnection的缩写,意为开放式系统互联.国际标准化组织(ISO)制定了OSI模型,该模型定义了不同计算机互联的标准,是设计和描述计算机网络通信 ...
- [SharePoint] SharePoint 错误集 3
阅读目录 1. workflow 流程走不下去,报 workflow fails to run 的错误 2. 安装sharepoint prerequisit总是在web server (iis)这步 ...
- 如何编写Vault插件扩展Vault Explorer的功能
今天练习了一下Vault Explorer的扩展程序,基本上是Vault SDK中的HelloWord示例程序.如果你刚刚开始接触Vault的二次开发,希望对你有帮助. 开始之前,你需要安装Vault ...
- C C++ TDD单元测试非常好的书
http://product.china-pub.com/199003 测试驱动的嵌入式C语言开发 Test Driven Development for Embedded C <测试驱动的嵌入 ...
- 2015年Java开发岗位面试题归类
一.Java基础 1. String类为什么是final的. 2. HashMap的源码,实现原理,底层结构. 3. 说说你知道的几个Java集合类:list.set.queue.map实现类咯... ...
- iOS开源项目MobileProject功能点介绍
一:MobileProject简介 MobileProject项目是一个以MVC模式搭建的开源功能集合,基于Objective-C上面进行编写,意在解决新项目对于常见功能模块的重复开发,MobileP ...