PendingIntent 传值 需注意,以及其四个flag常量
来源:互联网 发布:大数据时代 pdf 编辑:程序博客网 时间:2024/05/01 08:18
常用通知类型的消息
long time=SystemClock.elapsedRealtime(); MyLog.e("RingingActivity ",String.format(Locale.getDefault(), "onclick time = %s;", time)); Intent i=new Intent(this,RingingActivity.class); Bundle b=new Bundle(); b.putLong("t", time); i.putExtra("t", time); i.putExtra("b", b); Notification n=new Notification(R.drawable.ic_launcher, "看看notification里面的时间是否变化了", System.currentTimeMillis()); PendingIntent pi=PendingIntent.getActivity(this, 0, i,PendingIntent.FLAG_UPDATE_CURRENT);// FLAG_UPDATE_CURRENT更新Intent;// FLAG_CANCEL_CURRENT;bu更新Pending;// FLAG_ONE_SHOT获取的PendingIntent只能使用一次,再使用PendingIntent也将失败// FLAG_NO_CREAT获取的PendingIntent若描述的Intent不存在则返回NULL值. n.setLatestEventInfo(this, "消息标题", "消息内容", pi); NotificationManager nm=(NotificationManager) getSystemService(NOTIFICATION_SERVICE); nm.notify(88, n);
当intent 传值出现问题和还有一种情况:就是单例的Activity:OnNewIntent 不走OnCreate 这个方法
===================================================扩展,灵活的Notification创建============================================
后续添加,今天心情不好
0 0
- PendingIntent 传值 需注意,以及其四个flag常量
- PendingIntent的flag
- PendingIntent中的flag
- Android PendingIntent的Flag设置
- JAVA反射修改常量,以及其局限
- JAVA反射修改常量,以及其局限
- JAVA反射修改常量,以及其局限
- Flag相关常量
- PendingIntent用法注意
- 关于onNewIntent的使用&PendingIntent flag赋值
- Notification中PendingIntent.Flag的应用
- Android Notification中PendingIntent.Flag的应用
- Span的四个常用flag的用法
- SpannableString的四个flag的用法
- 常量指针与指向常量的指针以及“引用”的相关注意点
- c#编程四个注意
- PendingIntent与alermmanger以及TimerPicker
- Notification使用以及PendingIntent.getActivity()
- Java 集合系列01之 总体框架
- Canvas常用语法详解
- imx6sl recovery.img 解包和打包
- JSP_1th_第一个JSP程序
- bootstrap时间插件【带时分秒和不带时分秒的两个插件】
- PendingIntent 传值 需注意,以及其四个flag常量
- thinkphp3.2 怎么读取config.php 的内容, 并且显示在我们实际应用当中
- php 将秒数转换为时间(年、天、小时、分、秒)
- struts2-spring-hibernate实现员工的增删查功能
- 矩阵变换
- 不要相信缘分和心
- 【PHP】PHP中对于Redis的操作。
- promise的简单使用
- android 休眠唤醒机制分析(一) — wake_lock