android Notification 声音和震动正常,呼吸等不亮?求大神
来源:互联网 发布:js原型概念 编辑:程序博客网 时间:2024/04/27 21:42
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
//构建一个通知对象(需要传递的参数有三个,分别是图标,标题和 时间)
Notification notification = new Notification(R.drawable.ic_launcher,"通知",System.currentTimeMillis());
Intent intent = new Intent(MyActivity.this,MyActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(MyActivity.this,0,intent,0);
CharSequence contentText = "iiiiiiiiiii" + a;
notification.setLatestEventInfo(getApplicationContext(), "通知标题" + a , contentText, pendingIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;//点击后自动消失
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.ledARGB = Color.RED;
notification.ledOnMS = 1;
notification.ledOffMS = 0;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
manager.notify(id, notification);//发动通知,id由自己指定,每一个Notification对应的唯一标志
//构建一个通知对象(需要传递的参数有三个,分别是图标,标题和 时间)
Notification notification = new Notification(R.drawable.ic_launcher,"通知",System.currentTimeMillis());
Intent intent = new Intent(MyActivity.this,MyActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(MyActivity.this,0,intent,0);
CharSequence contentText = "iiiiiiiiiii" + a;
notification.setLatestEventInfo(getApplicationContext(), "通知标题" + a , contentText, pendingIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;//点击后自动消失
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.ledARGB = Color.RED;
notification.ledOnMS = 1;
notification.ledOffMS = 0;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
manager.notify(id, notification);//发动通知,id由自己指定,每一个Notification对应的唯一标志
0 0
- android Notification 声音和震动正常,呼吸等不亮?求大神
- Android Notification 的声音和震动
- Android Notification 关闭 取消 震动 关闭取消声音和 Notification进行下载文件
- android实现震动和声音
- Android Notification实现推送消息过程中接受到消息端有声音及震动及亮屏提示
- Android学习--多媒体功能:通知 notification(振动,声音,呼吸灯)
- 震动和声音
- 震动和声音
- 手机播放声音和震动
- ios 播放声音和震动
- IOS 播放声音和震动
- iOS 播放声音和震动
- iOS 播放声音和震动
- 震动和系统声音提示
- android notification 自定义声音
- Android 适配---notification led 呼吸灯
- Android NOtification 使用(震动 闪屏 铃声)
- Android NOtification 使用(震动 闪屏 铃声) .
- WebRTC源码架构浅析
- ALV下拉菜单实例
- LeetCode: Single Number
- 清空Mac上的废纸篓
- 使用maven的maven-assembly-plugin将jar包依赖打包到一个jar文件中
- android Notification 声音和震动正常,呼吸等不亮?求大神
- 石英晶振的主要参数
- 从FreeBSD源码中看到的东西
- 火车票
- Servlet编程中,将网页数据导出到Excel
- 树莓派开发系列教程6——树莓派做wifi热点
- DecimalFormat用法
- HDU1056 HangOver
- Could not initialize class sun.awt.X11GraphicsEnvironment