Add a comment
This commit is contained in:
parent
2847a51674
commit
ece53f7687
|
@ -752,6 +752,9 @@ class MediaPlayerService : Service() {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getInstance(): MediaPlayerService? {
|
fun getInstance(): MediaPlayerService? {
|
||||||
val context = UApp.applicationContext()
|
val context = UApp.applicationContext()
|
||||||
|
// Try for twenty times to retrieve a running service,
|
||||||
|
// sleep 100 millis between each try,
|
||||||
|
// and run the block that creates a service only synchronized.
|
||||||
for (i in 0..19) {
|
for (i in 0..19) {
|
||||||
if (instance != null) return instance
|
if (instance != null) return instance
|
||||||
synchronized(instanceLock) {
|
synchronized(instanceLock) {
|
||||||
|
|
Loading…
Reference in New Issue