Reputation: 25
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!
Upvotes: 0
Views: 37
Reputation: 1313
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/
Upvotes: 1
Reputation: 13129
You can do it in two ways, using the singleton pattern or using a background service (recommended)
Upvotes: 0