4ef64ad Realized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.
f047218 Added playback sync state to more places and added a fallback to last server session if no local session is found.
Realized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.
How have you tested this?
Running on phone and emulator. Play a book swipe to close audiobookshelf in recents. Open audiobookshelf and player opens with the correct book and play state. Without these changes the ui and services were un-aware of the current play state. Tested in multiple states closing and opening the app. Still testing with previous pr to make sure it solves android auto and syncing issues.
Update: tested throughout the day and not seeing any increased battery usage. Still working great and listening sessions are being recorded in server.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1641
**Author:** [@AwsomeFox](https://github.com/AwsomeFox)
**Created:** 7/24/2025
**Status:** 🔄 Open
**Base:** `master` ← **Head:** `fix-app-playback-sync`
---
### 📝 Commits (2)
- [`4ef64ad`](https://github.com/advplyr/audiobookshelf-app/commit/4ef64ade1c49114c68ef5291e6b7ad22ae112dd5) Realized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.
- [`f047218`](https://github.com/advplyr/audiobookshelf-app/commit/f047218ac0efe229eca251efd203ed8fba7c8d83) Added playback sync state to more places and added a fallback to last server session if no local session is found.
### 📊 Changes
**3 files changed** (+571 additions, -131 deletions)
<details>
<summary>View changed files</summary>
📝 `android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt` (+49 -0)
📝 `android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt` (+280 -131)
📝 `android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt` (+242 -0)
</details>
### 📄 Description
Followup to https://github.com/advplyr/audiobookshelf-app/pull/1640
<!--
For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details.
If you do not follow this template, the PR may be closed without review.
Please ensure all checks pass.
If you are a new contributor, the workflows will need to be manually approved before they run.
-->
## Brief summary
Playstate is not syncronized when the app is opened which means the player is missing and status is not synced when main process stopped and resumed.
<!-- Please provide a brief summary of what your PR attempts to achieve. -->
## Which issue is fixed?
<!-- Which issue number does this PR fix? Ex: "Fixes #1234" -->
Could help with this issue https://github.com/advplyr/audiobookshelf-app/issues/1516 or other related server sync issues.
## Pull Request Type
Android
<!--
Does this affect only Android, only iOS, or both?
Does this change the frontend or the backend of the apps?
-->
## In-depth Description
Realized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.
<!--
Describe your solution in more depth.
How does it work? Why is this the best solution?
Does it solve a problem that affects multiple users or is this an edge case for your setup?
-->
## How have you tested this?
Running on phone and emulator. Play a book swipe to close audiobookshelf in recents. Open audiobookshelf and player opens with the correct book and play state. Without these changes the ui and services were un-aware of the current play state. Tested in multiple states closing and opening the app. Still testing with previous pr to make sure it solves android auto and syncing issues.
<!-- Please describe in detail with reproducible steps how you tested your changes. -->
Update: tested throughout the day and not seeing any increased battery usage. Still working great and listening sessions are being recorded in server.
## Screenshots
<!-- If your PR includes any changes to the front-end, please include screenshots or a
short video from before and after your changes. -->
https://github.com/user-attachments/assets/c75987c5-e9d3-4d8b-afda-d0db4b5c244f
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1641
Author: @AwsomeFox
Created: 7/24/2025
Status: 🔄 Open
Base:
master← Head:fix-app-playback-sync📝 Commits (2)
4ef64adRealized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.f047218Added playback sync state to more places and added a fallback to last server session if no local session is found.📊 Changes
3 files changed (+571 additions, -131 deletions)
View changed files
📝
android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt(+49 -0)📝
android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt(+280 -131)📝
android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt(+242 -0)📄 Description
Followup to https://github.com/advplyr/audiobookshelf-app/pull/1640
Brief summary
Playstate is not syncronized when the app is opened which means the player is missing and status is not synced when main process stopped and resumed.
Which issue is fixed?
Could help with this issue https://github.com/advplyr/audiobookshelf-app/issues/1516 or other related server sync issues.
Pull Request Type
Android
In-depth Description
Realized the playstate is not synced with UI when the application is resumed after being killed either in the app switcher by the user or in the background. This means the service tracking/syncronizing progress isn't updated either and the UI doesn't have an active player. With this change the playstate is synced when the app is resumed and the ui service is ready.
How have you tested this?
Running on phone and emulator. Play a book swipe to close audiobookshelf in recents. Open audiobookshelf and player opens with the correct book and play state. Without these changes the ui and services were un-aware of the current play state. Tested in multiple states closing and opening the app. Still testing with previous pr to make sure it solves android auto and syncing issues.
Update: tested throughout the day and not seeing any increased battery usage. Still working great and listening sessions are being recorded in server.
Screenshots
https://github.com/user-attachments/assets/c75987c5-e9d3-4d8b-afda-d0db4b5c244f
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.