[转]How to open specific page in the application by clicking on the notification
本文转自:https://github.com/phonegap-build/PushPlugin/issues/213
问:Hello, I would like to know how can I open a specific page in the application by clicking on the notification
答:
Here you have this piece of code (from my app) outside "devide ready" to recieve the push including the extra value. This works for me fine in ios and android (I can't tested it in wp8 becuse is not merged into build service until now)
//************************************ OUTSIDE DEVICE READY
// handle APNS notifications for iOS
function onNotificationAPN(e) {
// storage the e.id value (the extra value sent in push notification)
window.localStorage.setItem("push_que", e.id);
var push_que=e.id;
// if the push notification is coming inline
if (e.foreground=="1")
{
// storage the e.numero value (the extra value sent in push notification)
window.localStorage.setItem("push_que", e.id);
var push_que=e.id;
/// some code here to open a message if a new push is recieved inline
;}
if ( event.alert )
{
navigator.notification.alert(event.alert);
}
if ( event.sound )
{
var snd = new Media(event.sound);
snd.play();
}
if ( event.badge )
{
pushNotification.setApplicationIconBadgeNumber(successHandler, errorHandler, event.badge);
}
}
// handle GCM notifications for Android
function onNotificationGCM(e) {
switch( e.event )
{
if (e.foreground)
{
// if the push is recieved inline
// storage the value of playoad.id, the extra value sent by push
window.localStorage.setItem("push_que", e.payload.id);
var push_que=e.payload.id;
}
else
{
// otherwise we were launched because the user touched a notification in the notification tray
if (e.coldstart)
{
// storage the value of playoad.numero, the extra value sent by push
window.localStorage.setItem("push_que", e.payload.id);
}
else
{
// storage the value of playoad.numero, the extra value sent by push
window.localStorage.setItem("push_que", e.payload.id);
}
}
break;
case 'error':
break;
default:
break;
}
}
//********************************** END OUTSIDE DEVICE READY
[转]How to open specific page in the application by clicking on the notification的更多相关文章
- page,request,session,application四个域对象的使用及区别
转自:page,request,session,application四个域对象的使用及区别 1.page指当前页面.只在一个jsp页面里有效 .2.request 指从http请求到服务器处理结束, ...
- JSP属性的四种保存范围(page request session application)
JSP提供了四种属性的保存范围,分别为page.request.session.application 其对应的类型分别为:PageContext.ServletRequest.HttpSession ...
- java web作用域page request session application
转载自:http://blog.csdn.net/wyd458549392147/article/details/6944481 1.page指当前页面.只在一个jsp页面里有效 . 2.reques ...
- 《Springboot极简教程》问题解决:Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping for(转)
13.2 Spring Boot启动报错:Whitelabel Error Page 13.2 Spring Boot启动报错:Whitelabel Error Page 问题描述 Whitelabe ...
- 关于Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as ...
- Page Security
参见开发文档 Overview This document describes how to build applications that grant selected access to indi ...
- Page Controller页面控制器实现
A Page Controller is one object or file declaration designed to handle the request for one logical w ...
- Selenium - WebDriver: Page Objects
This chapter is a tutorial introduction to page objects design pattern. A page object represents an ...
- V-Play 文档翻译 Page
V-Play 文档翻译 Page 翻译:qyvlik 应用的一个页面. VPlayApps 1.0 Inherits: MouseArea Inherited By: ListPage 属性 Item ...
随机推荐
- Redis 3.2.1集群搭建
一.概述 Redis3.0版本之后支持Cluster. 1.1.redis cluster的现状 目前redis支持的cluster特性: 1):节点自动发现 2):slave->master ...
- .net c# 视频剪切抓取缩略图
public string Cut(string ffmpegPath, string videoPath, string savePath, string imgSize, int sleepTim ...
- 运用Gulp压缩文件编译文件。包括css js html image
安装node.js npm 以及安装gulp等方法我就不在这里赘述了. 接下里我主要介绍的是Gulpfile文件里面的配置该如何书写. var gulp = require('gulp');//引 ...
- Eclipse CDT Linux下内存分析 实战历险
C++产品开发,上线集成时,都需要内存泄露.覆盖率等检测,这些在Windows下都有很好的工具,如 Visual Studio: 这个内置了很多的工具 Devpartner: VC6时BoundChe ...
- Android studio git 本地仓库和远程仓库节点对比
1.初始状态 2.本地修改文件,然后commit 3.本地再次修改文件,然后commit 4.本地push 从上图可以看出,push完成后,本地仓库的节点和远程仓库的节点是一样的.
- Android终止线程的方法
线程对象属于一次性消耗品,一般线程执行完run方法之后,线程就正常结束了,线程结束之后就报废了,不能再次start,只能新建一个线程对象.但有时run方法是永远不会结束的.例如在程序中使用线程进行So ...
- sqlite3 not found问题解决方法
测试发现,有些Android手机自带sqlite3命令,有些不带.对于不带sqlite3的手机,我们可以手动将sqlite3加入系统. 执行如下命令 adb remount adb push 路径/s ...
- 使用TARGET_IPHONE_SIMULATOR和TARGET_OS_IPHONE宏区分模拟器和设备
#if TARGET_IPHONE_SIMULATOR NSLog(@"run on simulator"); #else NSLog ...
- Mac wifi已打开但尚未连接到网络
把网络偏好设置 里面的询问新网络 关闭了 然后 重启电脑 试一下 应该就可以了
- OC中UITabBarController控制器
UITabBarController UITabBarController(记为O)常用于管理多个导航控制器,例如有ABC三个导航控制器,可以:addChildViewController(记为A), ...