From cfaa6e374fb31eba4e88206253f012183553627a Mon Sep 17 00:00:00 2001 From: lisonge Date: Thu, 9 Nov 2023 20:39:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E4=BE=9B=E6=8D=95=E8=8E=B7?= =?UTF-8?q?=E5=BF=AB=E7=85=A7=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=20(#253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 4 +++ .../songe/gkd/debug/SnapshotActionService.kt | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 app/src/main/java/li/songe/gkd/debug/SnapshotActionService.kt 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