如何获取notification 的消息,内容? android中如果当前收到新的email会在status bar中显示一个表示新mail的图标,然后发出提示声音.我现在要单独做一个应用程序实现这个功能,请问我要怎么要才能获取到notification发出来的消息以及内容? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 通知不就是用到了pendingIntent吗?可以在里面的intent里存数据,当点击通知跳转到activity时就把值取出来咯 pendingIntent,请问有具体的code参考一下吗? NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.mz,"通知", System.currentTimeMillis()); Intent newintent = new Intent(context,DownLoad.class); newintent.putExtra("height", 123);//存入数据 newintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); newintent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pendingIntent = PendingIntent.getActivity( context, 0, newintent, 0 ); notification.setLatestEventInfo(context, "资源下载", "资源下载中...", pendingIntent); notification.flags|=Notification.FLAG_ONGOING_EVENT; //一直存在 notification.defaults |= Notification.DEFAULT_SOUND; //默认声音 notificationManager.notify(0, notification);//发起通知这样存进去,然后,接收就可以。intent.getIntExtra("height"); getIntent()获取一个Intent对象,通过Intent对象可以获取各值了 我现在新做一个a.apk的c.activity中如何去获取这个intent对象呢? 在Android源码环境下开发,如何使用ksoap2 ? Canvas与Bitmap画图的问题 如何实现模拟电源按钮 求教各路高手,怎么编译出.so文件? 一个很急的Android相机问题,在线等!!! 请问关于runnable的问题 DDMS发送中文短信时出现乱码如何解决 请大家给点思路,挑战杯准备弄一个语音识别的软件 手机的已读报告 button设置背景图片,有边框 Android上如何创建一个UI android2.1读取联系人 排序如何实现
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.mz,"通知",
System.currentTimeMillis()); Intent newintent = new Intent(context,DownLoad.class);
newintent.putExtra("height", 123);//存入数据
newintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
newintent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(
context,
0,
newintent,
0
); notification.setLatestEventInfo(context,
"资源下载",
"资源下载中...",
pendingIntent);
notification.flags|=Notification.FLAG_ONGOING_EVENT; //一直存在
notification.defaults |= Notification.DEFAULT_SOUND; //默认声音
notificationManager.notify(0, notification);//发起通知
这样存进去,然后,接收就可以。intent.getIntExtra("height");