pull/32/head
gedoor 6 years ago
parent ca3b1a8334
commit 35a1ce62cd
  1. 6
      app/src/main/java/io/legado/app/App.kt

@ -89,7 +89,8 @@ class App : Application() {
*/
@RequiresApi(Build.VERSION_CODES.O)
private fun createChannelId() {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
notificationManager?.let {
//用唯一的ID创建渠道对象
val downloadChannel = NotificationChannel(
channelIdDownload,
@ -124,6 +125,7 @@ class App : Application() {
webChannel.setSound(null, null)
//向notification manager 提交channel
notificationManager.createNotificationChannels(Arrays.asList(downloadChannel, readAloudChannel, webChannel))
it.createNotificationChannels(Arrays.asList(downloadChannel, readAloudChannel, webChannel))
}
}
}

Loading…
Cancel
Save