minor fix

This commit is contained in:
Thibault Deckers 2022-11-09 14:57:39 +01:00
parent ea1f19fc9d
commit da209ff1bc
3 changed files with 18 additions and 16 deletions

View file

@ -168,6 +168,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.exifinterface:exifinterface:1.3.5'
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.caverock:androidsvg-aar:1.4'

View file

@ -9,6 +9,8 @@ import android.content.ServiceConnection
import android.os.Build
import android.os.IBinder
import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ProcessLifecycleOwner
import deckers.thibault.aves.AnalysisService
import deckers.thibault.aves.AnalysisServiceBinder
import deckers.thibault.aves.AnalysisServiceListener
@ -63,6 +65,11 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp
.putExtra(AnalysisService.KEY_ENTRY_IDS, entryIds?.toIntArray())
.putExtra(AnalysisService.KEY_FORCE, force)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val appState = ProcessLifecycleOwner.get().lifecycle.currentState
if (!appState.isAtLeast(Lifecycle.State.STARTED)) {
result.error("startAnalysis-background", "cannot start foreground service from background", null)
return
}
activity.startForegroundService(intent)
} else {
activity.startService(intent)

View file

@ -75,28 +75,16 @@ class Constants {
static const String mit = 'MIT License';
static const List<Dependency> androidDependencies = [
Dependency(
name: 'AndroidX Core-KTX',
license: apache2,
licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/LICENSE.txt',
sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/core/core-ktx',
),
Dependency(
name: 'AndroidX Exifinterface',
license: apache2,
licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/LICENSE.txt',
sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/exifinterface/exifinterface',
),
Dependency(
name: 'AndroidSVG',
license: apache2,
sourceUrl: 'https://github.com/BigBadaboom/androidsvg',
),
Dependency(
name: 'Android-TiffBitmapFactory (Aves fork)',
license: mit,
licenseUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory/blob/master/license.txt',
sourceUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory',
name: 'AndroidX (Core Kotlin, Exifinterface, Lifecycle Process, Multidex)',
license: apache2,
licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/LICENSE.txt',
sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/core/core-ktx',
),
Dependency(
name: 'CWAC-Document',
@ -123,6 +111,12 @@ class Constants {
license: eclipse1,
sourceUrl: 'https://github.com/deckerst/pixymeta-android',
),
Dependency(
name: 'Tiff Bitmap Factory (Aves fork)',
license: mit,
licenseUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory/blob/master/license.txt',
sourceUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory',
),
];
static const List<Dependency> _flutterPluginsCommon = [