Sub Service_Start (StartingIntent As Intent)
Dim RunInBackground as boolean
'set value of RunInBackground to a stored preference value
RunInBackground = [retrieve value from app preferences]
If RunInBackground = False then
StopService("") 'stops current service
Else
'run service code normally
End if
End Sub