Notification用法
String message = "You should click come back now. It is time out more than 10 minutes.";
// MessageDialog.showMessageDialog(MainActivity.act, message); Intent intent = new Intent(MainActivity.this, MainActivity.class);
// intent.setAction(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_LAUNCHER);
// intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0 /* Request code */, intent,
PendingIntent.FLAG_CANCEL_CURRENT); //PendingIntent.FLAG_UPDATE_CURRENT // Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(MainActivity.this)
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.drawable.ba)
.setContentTitle(getString(R.string.app_name))
.setContentText(message)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX)
// .setSound(defaultSoundUri)
.setContentIntent(pendingIntent); NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); long time = new Date().getTime();
String tmpStr = String.valueOf(time);
String last4Str = tmpStr.substring(tmpStr.length() - 5);
int mId = Integer.valueOf(last4Str);
notificationManager.notify(mId /* ID of notification */, notificationBuilder.build());
Notification用法的更多相关文章
- PhoneGap中navigator.notification.confirm的用法详解
navigator.notification.confirm('您确定要退出程序吗?', showConfirm, '退出程序', '确定,取消'); function showConfirm(but ...
- Android之Notification的多种用法(转)
我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...
- Android之Notification的多种用法
我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...
- Notification (通知)的 新版和旧版用法
Notification (通知)的 新版和旧版用法 一.先来看旧版,Api 11 之前的用法: NotificationManager manager = (NotificationManage ...
- Android API Level在11前后及16之后时Notification的不同用法
作为刚入门Android的小白,最近在按照郭大神的<第一行代码>在练习,在用到Notification时遇到了一些问题,网上资料比较零散,我这里做了一个总结分析给各位,若有错误,恳请指正~ ...
- Android学习总结(十五) ———— Notification(状态栏通知)基本用法
一.Notification基本概念 Notification是一种具有全局效果的通知,它展示在屏幕的顶端,首先会表现为一个图标的形式,当用户向下滑动的时候,展示出通知具体的内容.我们在用手机的时候 ...
- Android Notification.setLatestEventInfo弃用和Notification.Builder用法
今天在学习小米便签的源码的时候,至于源码的地址,http://m.blog.csdn.net/article/details?id=50544248 ,里面有好多github的开源项目,打开项目,报错 ...
- 3、android notification 详细用法
在 android 系统中,在应用程序可能会遇到几种情况需要通知用户,有的需要用户回应,有的则不需要,例如: * 当保存文件等事件完成,应该会出现一个小的消息,以确认保存成功. * 如果应用程序在后台 ...
- 2.6.2 Notification的功能与用法
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...
随机推荐
- jquery实现多行文字图片滚动效果
今儿分享一个jquery实现多行滚动效果. 我看一些论坛网站上面,公告处用的较多. 代码如下 复制代码 // 多行滚动(function($){$.fn.extend({Scroll:function ...
- Lua数据结构的学习笔记
更多详细内容请查看:http://www.111cn.net/sys/linux/59911.htm table是Lua中唯一的数据结构,其他语言所提供的其他数据结构比如:arrays.records ...
- Dos下查询关闭端口的命令例子
1. 查看端口占用 在windows命令行窗口下执行: netstat -aon|findstr "8080" TCP 127.0.0.1:80 0.0.0 ...
- 20141110--SQL视图
--------------------------视图--------------------- --视图是一个虚拟表,数据来自于原表,原表的数据改变,视图也会改变 select Student.S ...
- UI5_UIAlertView与UIActionSheet
// // ViewController.h // UI5_UIAlertView与UIActionSheet // // Created by zhangxueming on 15/7/7. // ...
- 《HTML5与CSS3基础教程》学习笔记 ——Four Day
第十六章 1. 输入和元素 电子邮件框 <input type="email"> 搜索框 <input type="search"> ...
- Archiving
There are typically four steps of archving: Preprocessing Write Store Delete Normally Store is inv ...
- 清空系统日志shell scripts——自学笔记
这是一个清空系统日志的脚本: vim logmess_clean.sh #bin/bash //该脚本所使用的shell解释器 cd /var/log/ //切换到存放日志目录 ech ...
- linq 日常关键字使用
1.from var scoreQuery = from student in students from score in student.Scores where score > 90 se ...
- hi,mongo!(1)
用了很多年的关系型数据库,想换一种思路,学习一下最近比较火的mongo数据库. 一.下载.安装mongo 下载地址:http://www.mongodb.org/downloads(官网) 官网的mo ...