关于notification的使用出错

点点_123 点点_123 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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);
}
};

代码
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
点点_123
Android 80,490 成员 91,371 内容