Android Notification 通知栏点击不能跳转

先说下我遇到的问题:

http://c.tieba.baidu.com/p/3466335206

http://c.tieba.baidu.com/p/3466336108

http://c.tieba.baidu.com/p/3466337185

在应用关闭的时候,发送通知到通知栏,点击通知栏能正常跳转到我想要的页面,代码如下

?


1

2

3

4

5

6

7

8

Intent
msgIntent =
new

Intent();

http://c.tieba.baidu.com/p/3466335206

http://c.tieba.baidu.com/p/3466336108

http://c.tieba.baidu.com/p/3466337185

msgIntent.addCategory(Intent.CATEGORY_LAUNCHER);

                        msgIntent.setComponent(new

ComponentName(context.getPackageName(),
"com.test.FragmentActivity"));

msgIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
//
关键的一步,设置启动模式

UITools.showNotification(context,
Notify.NORMAL, msgIntent, jsonBean.getMessageTitle());

http://c.tieba.baidu.com/p/3466335206

http://c.tieba.baidu.com/p/3466336108

http://c.tieba.baidu.com/p/3466337185

在应用打开的情况下,发送通知,代码如下:

?


1

2

3

4

5

6

7

Intent
msgIntent =
new

Intent();

msgIntent.setClass(context,
FragmentActivity.
class);

msgIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
//
关键的一步,设置启动模式

UITools.showNotification(context,
Notify.NORMAL, msgIntent, jsonBean.getMessageTitle());

http://c.tieba.baidu.com/p/3466335206

http://c.tieba.baidu.com/p/3466336108

http://c.tieba.baidu.com/p/3466337185

时间: 2024-08-22 08:24:43

Android Notification 通知栏点击不能跳转的相关文章

android Notification 通知栏点击不能跳转(转自:http://www.oschina.net/question/778954_212394)

roid Notification 通知栏点击不能跳转 关于通知栏Notification的使用,不多讲,这里说的很清楚http://www.cnblogs.com/zenfly/archive/2012/02/09/2343923.html 先说下我遇到的问题: 在应用关闭的时候,发送通知到通知栏,点击通知栏能正常跳转到我想要的页面,代码如下 ? 1 2 3 4 5 6 7 8 Intent msgIntent = new Intent(); msgIntent.addCategory(Int

Android Notification通知栏 下载控件

开启一个服务,服务中 启动一个通知. 通知中 下载. Android之Notification的多种用法 http://blog.csdn.net/loongggdroid/article/details/17616509 Android多任务下载,使用Notification更新进度条: http://cn23snyga.iteye.com/blog/1902071 Android4.1:通知栏显示可点击的按钮-Notification.builder Sample: http://blog.

Android Notification通知栏开发详解

Notification是在你的应用常规界面之外展示的消息.当app让系统发送一个消息的时候,消息首先以图表的形式显示在通知栏.要查看消息的详情需要进入通知抽屉(notificationdrawer)中查看.通知栏和通知抽屉(notificationdrawer)都是系统层面控制的,你可以随时查看,不限制于app. 图 1.通知栏的通知 图 2. notificationdrawer中的通知. Notification 的设计 作为android UI中很重要的组成部分,notification

android web页面点击事件跳转至APP

直接上代码 1.而对于点击链接后,能否直接打开,可以通过下面的代码来实现.前提条件:你得知道你的APP对应的打开协议,在<intent-filter>中设置scheme.如微信,协议为:weixin:// ,and so on... <!-- a标签的链接,设置为对应的下载链接:点击打开的动作,在click事件中注册 --> <a href="http://www.baidu.com" id="openApp">打开APP<

Android自定义通知布局Notification,点击Notification导航切换回原Activity

一个简单的应用场景:假如用户打开Activity以后,按Home键,此时Activity 进入-> onPause() -> onStop() 不可见.代码在此时机发送一个Notification到通知栏.当用户点击通知栏的Notification后,又重新onRestart() -> onStart() -> onResume() 切换回原Activity. package zhangphil.pendingintent; import android.os.Bundle; im

android Notification 的使用(锁定通知栏)

最近一直在研究 android ,并一边研究一边做应用.其中遇到了把程序通知常驻在 Notification 栏,并且不能被 clear 掉(就像android QQ一样)的问题.经过研究实现了其功能,现把 Notification 的使用总结如下: Notification 的使用需要导入 3 个类 1 2 3 import android.app.PendingIntent; import android.app.NotificationManager; import android.app

如何知道我在通知栏的展示的 Notification 被点击了?

在某些业务需求下,我们需要统计发出去的通知被点击的次数,但是察看 Notifycation 和 NotifycationManager 里面都没有相关方法来设置点击监听器! 那怎么办? Notifycation 本来就需要我们给他设置一个 Intent 来执行点击之后的动作,这个 Intent 通过 PendingIntent 赋予. 关于 PendingIntent 刚接触可能会觉得不理解,官方解释:A description of an Intent and target action to

使用Android点击按钮跳转页面

1.首先新建一个Android工程,命名为MyApp(名字可以自己随意起); 2.以原有的MainActivity.java文件为登录界面,然后在src文件中的包上面右击选择New目录下的Other中的Android Activity,选择BlankActivity,修改一个Activity的名字(自定义),我这里命名为BankActivity,点选finish然后新建完成一个返回页面;\ 3.接下来就要添加布局文件了,我们在res文件下的layout文件里先双击activity_main.xm

如何绑定android点击事件--跳转到另一个页面并实现关闭功能?

一.点击按钮跳转到另一个页面. eg:实现从一个页面点击跳转到另一个页面 1.首先在一个布局文件(.XML)中绘画了一个跳转按钮(id为btn1): <Button         android:id="@+id/btn1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:tex