关于notification的使用出错
Thread downloadThread = new Thread() {
@Override
public void run() {
int flagSong = download.downloadFile(songFile);
download.setUrl_path(urlLrc);
int flagLrc = download.downloadFile(lrcFile);
int flag = flagSong + flagLrc;
Notification notification;
if (flag == 2) {
notification = new Notification(android.R.id.icon2,
"download", java.lang.System.currentTimeMillis());
notification.setLatestEventInfo(RemoteMp3Activity.this,
"下载", "下载完成", null);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults = Notification.DEFAULT_SOUND;
} else {
notification = new Notification(
android.R.drawable.arrow_up_float, "download",
java.lang.System.currentTimeMillis());
Intent notificationIntent = new Intent(
RemoteMp3Activity.this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(
RemoteMp3Activity.this, 0, notificationIntent, 0);
notification.setLatestEventInfo(RemoteMp3Activity.this,
"下载", "下载未完成", pendingIntent);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults = Notification.DEFAULT_SOUND;
}
manager.notify(SONG_DOWNLOAD, notification);
}
};代码
相关推荐
HTML5之消息通知的使用(Web Notification)
关于 HTML5 ,写了不少文章,总觉得相关的高级 API 都得过一遍。系统的了解,站在更高的高度去思考问题,这样才能事半功倍。 一、先睹为快 我们先来尝试一个最简单的例子,打开 chrome 开发者工具,粘贴代码进去直接运行: new Notification('Jartto's 消息通知', { dir: 'rtl', body: '这是一个消息,通过 Web Notification 发送,作为测试!', icon: 'https://raw.githubusercontent.com/chenfengyanyu/my-web-accumulation/master/ima
通过Notification.Name看Swift是如何优雅的解决String硬编码
主要给大家介绍了通过Notification.Name看Swift是如何优雅的解决String硬编码的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Notification最新用法、实现Notification的通知栏常驻、Notification的big View、解决Notification点击无效
Notification最新用法、实现Notification的通知栏常驻、Notification的各种样式big View、解决Notification点击无效
Notification的用法和PendingIntent使用
Notification的用法和PendingIntent的使用
notification各种使用
notification个使用,可自定义高度,布局


