【LED呼吸灯】求个简单的程序、只要亮就行

丶Jue 2015-08-01 01:34:34
小米2s、真机调试、但就是不亮、网上也搜不到、实在是没办法了、
...全文
348 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
丶Jue 2015-08-03
  • 打赏
  • 举报
回复
final int ID_LED=19871103; NotificationManager nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(); notification.ledARGB = 0x00FF00; //这里是颜色,我们可以尝试改变,理论上0xFF0000是红色,0x00FF00是绿色 notification.ledOnMS = 100; notification.ledOffMS = 100; notification.flags = Notification.FLAG_SHOW_LIGHTS; nm.notify(ID_LED, notification); nm.cancel(ID_LED); //也是网上找的
github_neolau 2015-08-03
  • 打赏
  • 举报
回复
请附上你的代码. 我在网上找了下,我没有试.
引用
Notification.Builder noteBuilder = new Notification.Builder(context) .setAutoCancel(true) .setPriority(Notification.PRIORITY_DEFAULT) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(ContentTitle) .setContentText(ContentText) .setLights(Color.YELLOW, 500, 500) ; Intent noteIntent = new Intent(context,HoofdScherm.class); PendingIntent notePendingIntent = PendingIntent.getActivity(context, 0, noteIntent, PendingIntent.FLAG_CANCEL_CURRENT); noteBuilder.setContentIntent(notePendingIntent); Notification note = noteBuilder.build(); note.ledARGB = Color.YELLOW; NotificationManager mgr = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); mgr.notify(0,note);
引用
You need to make sure all the defaults are overridden by setting notification.defaults = 0;
丶Jue 2015-08-01
  • 打赏
  • 举报
回复
111111

80,348

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧