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用法的更多相关文章

  1. PhoneGap中navigator.notification.confirm的用法详解

    navigator.notification.confirm('您确定要退出程序吗?', showConfirm, '退出程序', '确定,取消'); function showConfirm(but ...

  2. Android之Notification的多种用法(转)

    我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...

  3. Android之Notification的多种用法

    我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...

  4. Notification (通知)的 新版和旧版用法

    Notification (通知)的 新版和旧版用法   一.先来看旧版,Api 11 之前的用法: NotificationManager manager = (NotificationManage ...

  5. Android API Level在11前后及16之后时Notification的不同用法

    作为刚入门Android的小白,最近在按照郭大神的<第一行代码>在练习,在用到Notification时遇到了一些问题,网上资料比较零散,我这里做了一个总结分析给各位,若有错误,恳请指正~ ...

  6. Android学习总结(十五) ———— Notification(状态栏通知)基本用法

    一.Notification基本概念  Notification是一种具有全局效果的通知,它展示在屏幕的顶端,首先会表现为一个图标的形式,当用户向下滑动的时候,展示出通知具体的内容.我们在用手机的时候 ...

  7. Android Notification.setLatestEventInfo弃用和Notification.Builder用法

    今天在学习小米便签的源码的时候,至于源码的地址,http://m.blog.csdn.net/article/details?id=50544248 ,里面有好多github的开源项目,打开项目,报错 ...

  8. 3、android notification 详细用法

    在 android 系统中,在应用程序可能会遇到几种情况需要通知用户,有的需要用户回应,有的则不需要,例如: * 当保存文件等事件完成,应该会出现一个小的消息,以确认保存成功. * 如果应用程序在后台 ...

  9. 2.6.2 Notification的功能与用法

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...

随机推荐

  1. 十八、Android引导界面

    一.所需素材 很有必要整理一下,里面附带友盟的社会化分享组件,我就不去掉了. 二.代码 import com.umeng.update.UmengUpdateAgent; import android ...

  2. 增强for循环用法___ArrayList数组实现使用下标最好,LinkedList使用增强型的(转载)

    总结: 1.For-Each循环的缺点:丢掉了索引信息. 当遍历集合或数组时,如果需要访问集合或数组的下标,那么最好使用旧式的方式来实现循环或遍历,而不要使用增强的for循环,因为它丢失了下标信息. ...

  3. 自学php找工作【二】 PHP计算时间加一天

    最近几天在做一个项目,主要是将SQLserver数据到MySQL数据库,一个url跑一次 同步一次昨天的数据,由于很多数据需要同步,所以做了一个操作界面的,一个单纯跑url的 在其中涉及到了对于时间的 ...

  4. 第六篇、抽屉效果+UITabBarController(主流框架)

    依赖于第三方的框架RESideMenu 1.AppDelegate.m中的实现 - (BOOL)application:(UIApplication *)application didFinishLa ...

  5. CSS学习备忘

    CSS样式控制行间距,用line-height 测试一下: <div style="line-height:6px"> 111<br> 222<br& ...

  6. c语言 char*类型作为中间变量将许多字符串保存到一个数组的问题

    char*是一个字符串指针,如下面的程序value_作为一个中间变量用来在for循环中scanf输入的值的接收者,然后将value_保存到array中,但是一下程序会出现一个问题就是当你跳出这个函数时 ...

  7. IntellijIDEA 使用技巧

    1:显示工具栏目  toolbar:view ->ToolBar 2:加载源码   new project ->选择java project ->选择源码所在目录 ->ok

  8. Linux常用命令操作说明(链接)

    1. Busybox下tftp命令使用详解 2. Linux中rc的含义 3. <Unix文件系统结构标准>(Filesystem Hierarchy Standard) 4. 用size ...

  9. 2013-07-29 IT 要闻速记快想

    ### ========================= ###传动视暴雪82亿美元赎身,腾讯参与投资 ### ========================= ###帮助企业解决打印&邮 ...

  10. PHP CI 查询条件大全

    php CI 框架 this->db->where() 条件 PHP 5 版本 $this->db->where() 接受可选的第三个参数.如果你将它设置为 FALSE, Co ...