Android SDK level 26?

Hi,

Due to new Android restrictions on location tracking in background mode (https://developer.android.com/about/versions/oreo/background-location-limits.html), I have to use context.startForegroundService(...); to start the service that handles background location.

Problem is that Android Studio can’t build:
Error:(229, 22) error: cannot find symbol method startForegroundService(Intent)

I’ve updated cordova android to newest release: https://cordova.apache.org/announcements/2017/05/04/android-release.html

I’ve updated to Android SDK Build Tools 27
I’ve installed Android API 26

I’ve added this to my config.xml:


    <preference name="android-minSdkVersion" value="16" />
    <preference name="android-targetSdkVersion" value="26" />

Any Ideas, how I can get android to build?

Note: I know the code is OK, because I got it to build in the start, and actually made a release with it. But since I’ve called some ionic command that screwed it up… prepare, update, whatever…

I solved this by changing the:

target=android-26

in /platforms/android/project.properties. It is a hack because the file is generated - so still waiting for a better solution.

2 Likes

saved my live… thx!