diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0ae1283d8..d992017b9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -139,6 +139,10 @@ + diff --git a/app/src/main/java/li/songe/gkd/debug/SnapshotActionService.kt b/app/src/main/java/li/songe/gkd/debug/SnapshotActionService.kt new file mode 100644 index 000000000..23d7c1ade --- /dev/null +++ b/app/src/main/java/li/songe/gkd/debug/SnapshotActionService.kt @@ -0,0 +1,26 @@ +package li.songe.gkd.debug + +import android.app.Service +import android.content.Intent +import android.os.Binder +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import li.songe.gkd.appScope +import li.songe.gkd.util.launchTry + +/** + * https://github.com/gkd-kit/gkd/issues/253 + */ +class SnapshotActionService : Service() { + override fun onBind(intent: Intent?): Binder? = null + override fun onCreate() { + super.onCreate() + appScope.launch { + delay(1000) + stopSelf() + } + appScope.launchTry { + SnapshotExt.captureSnapshot() + } + } +} \ No newline at end of file