Skip to content

Commit

Permalink
Fix quick tile not working on Android 14+
Browse files Browse the repository at this point in the history
  • Loading branch information
udenr committed Jan 19, 2024
1 parent 927b910 commit 1cd49a8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.secuso.privacyfriendlycodescanner.qrscanner

import android.app.PendingIntent
import android.content.Intent
import android.os.Build
import android.service.quicksettings.TileService
Expand All @@ -13,7 +14,12 @@ class QuickTileService : TileService() {

val intent = Intent(this, ScannerActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)

startActivityAndCollapse(intent)
if (Build.VERSION.SDK_INT >= 34) {
startActivityAndCollapse(pendingIntent)
} else {
startActivityAndCollapse(intent)
}
}
}

0 comments on commit 1cd49a8

Please sign in to comment.