Android Question audiobook must keep on reading

andredamen

Active Member
Licensed User
Longtime User
I made an audiobook app. This reads MP3 files. When the site button on the phone is pressed or the phone is closed, playback stops. How can I ensure that the MP3 continues to be read aloud?
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
Look at this tutorial. You will see it mentioned in a lot of forum answers. I adapted it to behave as an MP3 player. It plays reliably in the background, and when I turn the 'phone off it continues playing long after the screen has gone dark.
 
Upvote 0

andredamen

Active Member
Licensed User
Longtime User
It still does not work. I am using Mediaplayer and when the phone is closed it still stops. I realy need some more help Brian. How did you adapt it in your MP3 player?
 
Last edited:
Upvote 0

zed

Active Member
Licensed User
Check this out, post #4
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
It still does not work. I am using Mediaplayer and when the phone is closed it still stops. I realy need some more help Brian.
Yes - I am using MediaPlayer, and it is in a service. I would like to give you some better help, but I am afraid that you have picked a day when I have absolutely no free time. I don't think that I can help you by simply sending you my app - you would not be able to see the wood for the trees, as we say, and there are some dependencies that I could not include so you could not run it.

All I can quickly say is that my app is activity-based (not B4XPages) running with SDK level 33; the Mediaplayer is in a service and that service is started by the Main activity; there are no additional manifest entries in this regard; and I do not remember running into any special requirements when coding it up. Sorry that I cannot be more helpful.
 
Upvote 0

andredamen

Active Member
Licensed User
Longtime User
Thanks Brian. I need te reconfigure my app and put the mediaplayer in a service. I tried some program lines and thisworks !
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…