I know about the update starting from api24 which states that a background service can't be launched based on network change and that there should be a foreground activity.
So I've tried using jobscheduler but it only works on api >= 21 so in order to make this work, do I have to test the user's api and if it's < 21 I use the old method and if the api >= 21 I use jobScheduler?
Is there no way to group the two in one block of code?