vedat 2 Posted December 2, 2021 Hello, I want to develop a music player app on fmx. As I understand from the research I must use foreground service to make a persistent menu on the status bar for next/play/pause musics. Do you have any document or source code that explains the usage of foreground service ? Thanks in advance Share this post Link to post
Dave Nottage 557 Posted December 2, 2021 7 hours ago, vedat said: As I understand from the research I must use foreground service to make a persistent menu on the status bar for next/play/pause musics Can you provide links to the research that shows that is what is required? Share this post Link to post
vedat 2 Posted December 3, 2021 10 hours ago, Dave Nottage said: Can you provide links to the research that shows that is what is required? Thank you for reply, here is the link https://developer.android.com/guide/components/foreground-services Share this post Link to post
Dave Nottage 557 Posted December 3, 2021 16 hours ago, vedat said: here is the link That's information about foreground services. How does "a persistent menu on the status bar for next/play/pause musics" relate to it? Share this post Link to post
vedat 2 Posted December 6, 2021 On 12/4/2021 at 2:22 AM, Dave Nottage said: That's information about foreground services. How does "a persistent menu on the status bar for next/play/pause musics" relate to it? Well, if you look at the link https://developer.android.com/guide/components/foreground-services it says : "Examples of apps that would use foreground services include the following: A music player app that plays music in a foreground service. The notification might show the current song that is being played." As I understand from this document, the notification of the current song can be played/paused or you can switched to next song through that notification bar. Notification bar stays there until the service closes down. Btw thank you for your care Share this post Link to post
Dave Nottage 557 Posted December 6, 2021 9 hours ago, vedat said: A music player app that plays music in a foreground service. The notification might show the current song that is being played This does not say that the app absolutely has to have a foreground service. The notification can be created without one: https://stackoverflow.com/questions/55324188/how-to-build-a-notification-in-android-and-implement-click-listener Share this post Link to post
vedat 2 Posted December 7, 2021 11 hours ago, Dave Nottage said: This does not say that the app absolutely has to have a foreground service. The notification can be created without one: https://stackoverflow.com/questions/55324188/how-to-build-a-notification-in-android-and-implement-click-listener But I want to show music menu notification bar even if the app was closed. Won't the music menu bar closed once you close your app if you don't use something that runs on background ? Share this post Link to post
Dave Nottage 557 Posted December 7, 2021 3 hours ago, vedat said: even if the app was closed Yes.. as far as I can ascertain, if the app is closed you would need a service to ensure the notification with the controls is persistent. Here's a problem with this scenario: you will not be able to use TMediaPlayer in a service, since it relies on FMX units, including FMX.Types, because of this issue: https://quality.embarcadero.com/browse/RSP-17857 so you would need to do your own implementation (or find one), avoiding the FMX units. Share this post Link to post
Turan Can 3 Posted December 8, 2021 This example will help you. Take a look at this. https://stackoverflow.com/questions/60466609/start-foreground-service-in-delphi-10-3 Share this post Link to post