wallabag / android-app

Android application to read your articles saved in your wallabag. You can also easily add new articles.
https://www.wallabag.org
GNU General Public License v3.0
482 stars 259 forks source link

Auto play next article not working on Android 10 and above #1312

Open KevinSJ opened 1 year ago

KevinSJ commented 1 year ago

Issue details

Duplicate?

No

Actual behaviour

Expected behaviour

Steps to reproduce the issue

  1. Find any article.
  2. Start text-to-speech, tick auto play next.
  3. Put the app in background and wait till tts finish the current article.

Environment details

Logs

wallabag server

Not relevant

Web server

Not relvant

Your experience with wallabag Android app

Really like it, have been using for more than a year, thanks for creating this app.

My Thoughts and Ideas

This functionality works well on my other Android device with Android 9, and [based on this],(https://developer.android.com/guide/components/activities/background-starts), it is a OS change that caused this. The current app will try to start activity from the background here, but it will fail because of the new change in Android 10 and above.

I had some rough ideas on what changes should be implemented, and actually had actually done the implementation locally. What I had done is to ask the user to allow draw on other app permission, if they allow the permission, the app would be able to start the ReadArticleActivity from background and therefore the next article would be read.

However, what I'm not sure about:

  1. where and when should the app ask the user for the draw on other app permsision? (Currently I put it in MainActivity, which I'm not sure is a good idea or not, cause my android dev knowledge is very limited)
  2. what should be done if the user do not allow the permisson? (Maybe send a toast?)

I'm willing to create a PR if I can get some help on the questions above (or I can create a PR based on whatever I have at the moment which is partially based on code from ChatGPT).