FOREGROUND_SERVICE_DATA_SYNCパーミッションの宣言と使用

This commit is contained in:
tateisu 2023-08-17 09:47:31 +09:00
parent 56f18e36fc
commit 3e5ba6b1ab
2 changed files with 8 additions and 2 deletions

View File

@ -69,6 +69,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<!-- CAMERAパーミッションをつけるとPlayストアにプライバシーポリシーを記載する必要がある -->
<!--<uses-permission android:name="android.permission.CAMERA"/>-->
@ -411,5 +412,11 @@
</intent-filter>
</receiver>
<receiver android:name="jp.juggler.subwaytooter.notification.NotificationDeleteReceiver" />
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="dataSync"
tools:node="merge" />
</application>
</manifest>

View File

@ -213,8 +213,7 @@ enum class NotificationChannels(
setWhen(System.currentTimeMillis())
setOngoing(true)
}
val useForegroundServiceType = false
return if (useForegroundServiceType && Build.VERSION.SDK_INT >= 34) {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ForegroundInfo(
nc.notificationId,
builder.build(),