「サービスのライフサイクル」をベースに他のアプリの上に重ねて表示を実現。
ポイントは「サービス」の許可要件に加え
●API 23からPermissionによるユーザーの許可が必要
app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
●API 26から使えるレイヤーは TYPE_APPLICATION_OVERLAY
権限要求には「deprecated対応」の androidx.activity.result.ActivityResultLauncher を採用。
テンプレートEmpty Activityからの差分情報
https://github.com/remixgrjp/Display-over-other-apps/commit/e4f34d4b8e8052e74006475f6ad7caea60daaf47
コンパイル済みのAPKはこちら。ソースは github
https://github.com/remixgrjp/Display-over-other-apps
ポイントは「サービス」の許可要件に加え
●API 23からPermissionによるユーザーの許可が必要
app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
●API 26から使えるレイヤーは TYPE_APPLICATION_OVERLAY
権限要求には「deprecated対応」の androidx.activity.result.ActivityResultLauncher を採用。
テンプレートEmpty Activityからの差分情報
https://github.com/remixgrjp/Display-over-other-apps/commit/e4f34d4b8e8052e74006475f6ad7caea60daaf47
コンパイル済みのAPKはこちら。ソースは github
https://github.com/remixgrjp/Display-over-other-apps