Code can control the LED notification in Android device, using android.app.Notification:

1
2
3
4
5
6
7
8
notification = new Notification();
notification.flags = Notification.FLAG_SHOW_LIGHTS; notification.ledARGB = ledColor;
notification.ledOffMS = 200;
notification.ledOnMS = 500; notificationManager.notify(0, notification);

ledARGB: The color of the led. The hardware will do its best approximation.

ledOffMS: The number of milliseconds for the LED to be off while it’s flashing. The hardware will do its best approximation.

ledOnMS: The number of milliseconds for the LED to be on while it’s flashing. The hardware will do its best approximation.

Notice, above 3 parameters are all explained as “The hardware will do its best approximation”.

In my Phone, ZTE U5, it seems that only Color.Red, Color.Green and Color.Yellow are supported. Color.Blue, Color.White and others doesn’t work.

Notification.FLAG_SHOW_LIGHTS references:

Since hardware varies, you are not guaranteed that any of the values you pass are honored exactly. Use the system defaults (TODO) if possible because they will be set to values that work on any given hardware.

So it’s better to use : notification.defaults = Notification.DEFAULT_LIGHTS;

Codes in Github.

LED notification in Android device的更多相关文章

  1. Android Device Orientation

    最近在处理相机拍照的方向问题,在Android Device的Orientation问题上有了些疑问,就顺便写个Demo了解下Android Device Orientation究竟是怎么个判断. A ...

  2. 解决Android Device Chooser 找不到设备问题

    第一种情况: 已经启动了官方的模拟器也进入了Android手机界面,可是在Android Device Chooser 看不到设备,怎么办? 例如以下图所看到的,使用Reset adb 或者在adb所 ...

  3. Android Device Chooser中显示Target unknown解决方法

    手机插在电脑上准备调试程序来着,通过eclipse运行时,弹出的Android Device Chooser中显示设备名是?????,Target未知,无法继续运行. 可以通过以下步骤解决(Ubunt ...

  4. 6.5、Android Studio的Android Device Monitor

    Android Device Monitor是一个独立的工具,可以对Android应用进行调试和分析.Android Device Monitor无需安装整合在一个IDE中,比如像Android St ...

  5. Android Device Administration 设备管理器——实现一键锁屏

    Android Device Administration 设备管理器--实现一键锁屏 最近研究了一下安全这一块的内容,当然,我是比较水的,所以也拿不出什么好知识点,但是有一些冷门的东西我还是可以聊聊 ...

  6. Android device debug (adb) by Charge Only mode

    Android device debug by Charge Only mode Method 1 Connect devices to computer and execute lsusb Find ...

  7. 解决 Android Device Monitor 常见问题

    Ø  简介 什么是 Android Device Monitor,中文意思就是安卓设备监视器,用于管理安装设备(手机.模拟器)用的.下面列出 Android Device Monitor 常见的一些问 ...

  8. Android Device Monitor 文件管理的常见问题 - z

    Android Device Monitor 是 Android Studio 中用于监测模拟器或真机运行状态的一款开发者工具.但开发者在使用它的过程中往往会遇到很多问题,尤其对于新手.本文分析了实际 ...

  9. 在Android Studio中打开Android Device Monitor时报错的解决方法

    在Android Studio中打开Android Device Monitor时报以下错误时(Android-SDK\tools\lib\monitor-x86_64\configuration\1 ...

随机推荐

  1. Visual Studio的调试技巧

    Visual Studio的调试技巧 [原文地址] Debugging Tips with Visual Studio 2010 [原文发表日期] 2010/8/19 10:48 AM 这是我写的关于 ...

  2. openstack虚拟机启动过程

    核心项目3个 1.控制台 服务名:Dashboard 项目名:Horizon 功能:web方式管理云平台,建云主机,分配网络,配安全组,加云盘 2.计算 服务名:计算 项目名:Nova 功能:负责响应 ...

  3. Azure媒体服务 直播延迟的原因解析

    当我们使用媒体服务的直播功能,会发现有时候会有较大的延迟,而延迟的产生和客户端以及推送软件的配置也有关系,本文以Wirecast为例进行分析 Encoder导致的延迟:在编码这一步骤的时候,它会消耗机 ...

  4. 兼容IE的写法收集||bug修复

    这篇文章实时更新 属于IE的专属写法 其中,S表示Standards Mode即标准模式,Q表示Quirks Mode,即兼容模式 hack 示例 IE6(S) IE6(Q) IE7(S) IE7(Q ...

  5. Linux--文件查找命令

    一.简介查找文件的几个命令: 1.which :查找可执行文件的位置 2.whereis:查找文件的位置,可以找到可执行命令和man page 3.locate:配合数据库查看文件位置 4.find: ...

  6. 【phpcms-v9】phpcms-v9二次开发所必须知道的步骤(转载)

    一.做phpcms-v9二次开发时,我们经常需要用到如下代码,所以有必须在这里注释说明一下 defined('IN_PHPCMS') or exit('No permission resources. ...

  7. apache 的工作模式

    总结:访问量大的时候使用 worker模式:  每个进程,启动多个线程来处理请求,每个线程处理一次请求,对内存要求比较高. prefoek模式 : 每个子进程只有一个线程,一次请求一个进程. 什么是a ...

  8. c#之Redis队列

    摘要 这两天一直在考虑redis队列:一个生产者,多个消费者的情况,这里弄了一个demo进行测试. 一个例子 关于如何引用Redisclient 可以参考之前的这篇文章:c#之Redis实践list, ...

  9. svn三大目录trunk、branch和tag

    SVN中Branch和tag的比较在SVN中Branch和tag在一个功能选项中,在使用中也往往产生混淆.在实现上,branch和tag,对于svn都是使用copy实现的,所以他们在默认的权限上和一般 ...

  10. 【转】常用的shell脚本

    from:http://blog.sina.com.cn/s/blog_4152a9f501013r6c.html 常用的shell脚本 (2012-10-10 22:09:07) 转载▼ 标签: 杂 ...