I have to say I have read the tutorials and threads concerning the Automatic Foreground Mode, and I am confused.
My first question is this. If my app calls a service to start in Foreground mode, do I have to add or change any code at all?
My second question is:
If I start a service simply by calling it from an activity, to I add the Service.StopAutomaticForeground line into the Service_Start sub like this, with nothing more required?
Answers to these two scenarios at least will get me started ...
My first question is this. If my app calls a service to start in Foreground mode, do I have to add or change any code at all?
B4X:
Sub Service_Create
' Service ----------------------------------------------------------------------------------------------
nUPnPSS_Notify.Initialize
nUPnPSS_Notify.Icon = "icon"
nUPnPSS_Notify.Sound=False
nUPnPSS_Notify.Vibrate=False
nUPnPSS_Notify.Light=False
nUPnPSS_Notify.OnGoingEvent=True
nUPnPSS_Notify.SetInfo("The Music Machine", "Subscriptions", "")
nUPnPSS_Notify.Notify(2)
Service.StartForeground(2, nUPnPSS_Notify)
(more code)
end sub
Sub service_Start
(code)
End sub
My second question is:
If I start a service simply by calling it from an activity, to I add the Service.StopAutomaticForeground line into the Service_Start sub like this, with nothing more required?
B4X:
' TMM_DBService
Sub Service_Create
lstAssembled.Initialize
lstMissingFiles.Initialize
lstNotDownLoaded.Initialize
lstNASMediaPaths.Initialize
sConnection = "?" & "dbname=" & TMM.gsDBName & "&username=" & TMM.gsUserName & "&userpassword=" & TMM.gsUserPassword
smbNas.Initialize("smbNAS")
smbNas.SetCredentials(TMM.gsUserName,TMM.gsUserPassword,"")
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground
End Sub
Sub Service_Destroy
End Sub
Answers to these two scenarios at least will get me started ...