Android通知代码
来源:互联网 发布:银行证券软件下载 编辑:程序博客网 时间:2024/05/19 23:23
public void notice() {String ns = Context.NOTIFICATION_SERVICE;NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);Context context = getApplicationContext();Intent notificationIntent = new Intent(this, MainActivity.class);PendingIntent contentIntent = PendingIntent.getActivity(this, 0,notificationIntent, 0);Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);Notification notification = new NotificationCompat// 注意:4.4.2版本使用的方法.Builder(context) //上下文.setAutoCancel(true) //自动取消.setContentTitle("title") //标题.setContentText("describe") //描述.setContentIntent(contentIntent)//通知动作.setSmallIcon(R.drawable.ic_launcher)//图标.setWhen(System.currentTimeMillis())//时间.setSound(alert)//声音.build();//建立通知mNotificationManager.notify(1, notification);}
0 0
- Android通知代码
- Android APP 版本更新通知代码
- notification android原生消息通知代码详解
- Android通知栏通知
- android利用反射通过代码收缩通知栏
- 如何在代码里打开Android手机通知状态栏
- 《第一行代码--Android》读书笔记之使用通知和多媒体
- android原生代码中的情景模式及提示音和通知
- Android-几行代码通知系统自动安装apk
- 多媒体和通知---《第一行代码Android》笔记
- android通知
- android 通知
- android 通知
- android通知
- android通知
- android 通知
- android通知
- android 通知
- string类的常用的几个小东西find,substr
- 穿过已知点画平滑曲线(3次贝塞尔曲线)
- nutch源代码阅读心得
- 设计模式之观察者模式
- hdu 4496(并查集的边删除)
- Android通知代码
- Android Studio使用gradle打包指定包名和类的jar
- 使用WebRTC搭建前端视频聊天室——入门篇
- 关于oracle实例即localhost:1521/orcl中的orcl
- sql server常用函数
- 论Android网络请求库——android-async-http
- 线性代数中向量、矩阵深度理解(PartI)
- MFC中SetFont(CFont *font)方法容易出错点
- C#中is,as,using关键字的使用