mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 23:00:31 +05:30
f345b142aa
It stills need more work, but for now I think is fine.
37 lines
1.1 KiB
Kotlin
37 lines
1.1 KiB
Kotlin
package com.github.libretube
|
|
|
|
import android.app.Application
|
|
import android.app.NotificationChannel
|
|
import android.app.NotificationManager
|
|
import android.os.Build
|
|
|
|
class myApp : Application() {
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
|
|
initializeNotificationChannels()
|
|
}
|
|
|
|
/**
|
|
* Initializes the required [NotificationChannel] for the app.
|
|
*/
|
|
private fun initializeNotificationChannels() {
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
// Create the NotificationChannel
|
|
val name = "Background Mode"
|
|
val descriptionText = "Shows a notification with buttons to control the audio player"
|
|
val importance = NotificationManager.IMPORTANCE_LOW
|
|
val mChannel = NotificationChannel("background_mode", name, importance)
|
|
mChannel.description = descriptionText
|
|
|
|
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
notificationManager.createNotificationChannel(mChannel)
|
|
}
|
|
}
|
|
|
|
companion object {
|
|
@JvmField
|
|
var seekTo: Long? = 0
|
|
}
|
|
}
|