Android Question Foreground Service and TargetSDK<28

Inman

Well-Known Member
Licensed User
Longtime User
I am trying to adapt this background location example into an old project of mine. That project has a targetSDK of 21 (Android 5.0). But now the app is going to run on an Android 9.0 device.

If I change targetSDK to 26 (Android 8.0), I will have to implement Runtime Permissions and all. To avoid that, I am trying to keep targetSDK at 21 itself. This app is not distributed via Play Store and so targetSDK requirements do not apply either. My question is this. Consider the following setup.
  • B4A 9.5
  • targetSDK = 21
  • android.jar from android-28
  • app to be running on an Android 9.0 device
In this case, does setting a foreground service manually as in the case of background location example, will make sure the service will not be killed, particularly because targetSDK is 21? Or should I go with the old Sticky Service concept?
 
Top