mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-05 02:25:45 +02:00
Fix initialize Paper for android auto
This commit is contained in:
parent
a69054fefa
commit
a06796d9ca
2 changed files with 9 additions and 7 deletions
|
@ -16,6 +16,8 @@ import kotlin.coroutines.suspendCoroutine
|
|||
class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
||||
val tag = "MediaManager"
|
||||
|
||||
var isPaperInitialized = false
|
||||
|
||||
var serverLibraryItems = listOf<LibraryItem>()
|
||||
var selectedLibraryId = ""
|
||||
|
||||
|
@ -28,8 +30,11 @@ class MediaManager(var apiHandler: ApiHandler, var ctx: Context) {
|
|||
var serverConfigIdUsed:String? = null
|
||||
|
||||
fun initializeAndroidAuto() {
|
||||
Log.d(tag, "Android Auto started when MainActivity was never started - initializing Paper")
|
||||
Paper.init(ctx)
|
||||
if (!isPaperInitialized) {
|
||||
Log.d(tag, "Android Auto started when MainActivity was never started - initializing Paper")
|
||||
Paper.init(ctx)
|
||||
isPaperInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
fun getIsLibrary(id:String) : Boolean {
|
||||
|
|
|
@ -701,11 +701,8 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
// No further calls will be made to other media browsing methods.
|
||||
null
|
||||
} else {
|
||||
if (!isStarted) {
|
||||
Log.d(tag, "AA Not yet started")
|
||||
mediaManager.initializeAndroidAuto()
|
||||
isStarted = true
|
||||
}
|
||||
isStarted = true
|
||||
mediaManager.initializeAndroidAuto()
|
||||
mediaManager.checkResetServerItems() // Reset any server items if no longer connected to server
|
||||
|
||||
isAndroidAuto = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue