[转]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 ...
随机推荐
- 基于jQuery的ajax对WebApi和OData的封装
基于jQuery的ajax对WebApi和OData的封装 WebApi 的使用带来了一个显著的特点,对type有一定的要求.一般ajax的type无非就是两种,GET和POST.如果用JSONP来跨 ...
- Python multi-thread 多线程 print 如何避免print的结果混乱
multithread如何写 这是我第一次写multithread,所以就是照着例子学,下面是我用来学的例子 来自于”Automate the boring stuff with Python”的15 ...
- 基于 Bootstrap 的响应式后台管理面板
你想建立一个后台管理面板或者分析仪表板吗?不需从头开始,Keen IO Bootstrap 是一个响应式的仪表盘模板,可以帮助你在几分钟内呈现数据,让你可以创建一个有吸引力的,定制的分析仪表板,随时可 ...
- JavaScript学习12 JS中定义对象的几种方式
JavaScript学习12 JS中定义对象的几种方式 JavaScript中没有类的概念,只有对象. 在JavaScript中定义对象可以采用以下几种方式: 1.基于已有对象扩充其属性和方法 2.工 ...
- ios网络编程学习
//网络访问获取数据//定义一个UIWebView属性,用来展示数据 @property (strong, nonatomic) IBOutlet UIWebView *myWebView; //.. ...
- 【代码笔记】iOS-侧滑效果
一,效果图. 二,工程图. 三,代码. AppDelegate.h #import <UIKit/UIKit.h> //加入头文件 #import "PPRevealSideVi ...
- GCD应用及其他方法
1.GCD应用 单例模式 static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ ...
- Android微信登陆
前言 分享到微信朋友圈的功能早已经有了,但微信登录推出并不久,文档写的也并不是很清楚,这里记录分享一下. 声明 欢迎转载,但请保留文章原始出处:) 博客园:http://www.cnblogs.co ...
- Entity Framework 4.1 - Code First 指定外键名称
Entity Framework 4.1 中,生成外键的方式有以下几种: 1-指定导航属性,会自动生成外键,命名规则为:“表名_主键名”2-默认情况下与导航属性的主键名称相同的字段会自动被标记为外键, ...
- c# 注册全局热键
//引入系统API [DllImport("user32.dll")] static extern bool RegisterHotKey(IntPtr hWnd, int id, ...