2022-02-01 21:22:06 +05:30
|
|
|
package com.github.libretube
|
2021-12-14 21:45:53 +05:30
|
|
|
|
|
|
|
import android.app.Application
|
2022-05-20 17:50:26 +05:30
|
|
|
import android.app.NotificationChannel
|
|
|
|
import android.app.NotificationManager
|
|
|
|
import android.os.Build
|
2021-12-14 21:45:53 +05:30
|
|
|
|
|
|
|
class myApp : Application() {
|
2022-05-20 17:50:26 +05:30
|
|
|
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"
|
2022-05-27 01:08:25 +05:30
|
|
|
val importance = NotificationManager.IMPORTANCE_LOW
|
2022-05-20 17:50:26 +05:30
|
|
|
val mChannel = NotificationChannel("background_mode", name, importance)
|
|
|
|
mChannel.description = descriptionText
|
|
|
|
|
|
|
|
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
|
|
notificationManager.createNotificationChannel(mChannel)
|
|
|
|
}
|
|
|
|
}
|
2021-12-14 21:45:53 +05:30
|
|
|
|
|
|
|
companion object {
|
|
|
|
@JvmField
|
2022-05-20 17:50:26 +05:30
|
|
|
var seekTo: Long? = 0
|
2021-12-14 21:45:53 +05:30
|
|
|
}
|
2022-05-20 17:50:26 +05:30
|
|
|
}
|