0

i'm creating an android application and i need to keep one song playing even if i went to another Activity. Help me please, thank you so much!

Ninoo
  • 25
  • 6

2 Answers2

1

Use a service, but it has to be a foreground service so that it has the highest priority so that it doesn't lag nor is killed by the system on low memory, follow this example: https://www.dev2qa.com/android-foreground-service-example/

Isaac Urbina
  • 1,295
  • 11
  • 21
0

You can do it in two ways, using the singleton pattern or using a background service (recommended)

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77