I have an app that uses a service to stream MP3 files. Some users would report that the stream would stop when running in the background so I added an option where they could run the app in persistent mode using this:
I am now using B4A v8.0 and Oreo users are seeing the service get killed so I added
to Service_Create. This corrects the issue on Oreo. My question, is there an advantage of one over the other? The other reason I ask is that the persistent mode code above crashes when compiled on v8.0. I haven't looked into why yet but I seem to remember seeing something regarding the order of setting to various Notification settings.
B4X:
Sub Service_Start (StartingIntent As Intent)
If GUI.PersistentPlayer Then
If Not(Notification1.IsInitialized) Then
Notification1.Initialize
Notification1.Insistent=False
Notification1.Light = False
Notification1.Sound = False
Notification1.Vibrate = False
Notification1.OnGoingEvent=True
Notification1.AutoCancel=False
End If
Service.StartForeground(NotificationID, Notification1)
End If
GetLocks
End Sub
I am now using B4A v8.0 and Oreo users are seeing the service get killed so I added
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS