Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ adb shell am broadcast -a com.chiller3.basicsync.AUTO_MODE com.chiller3.basicsyn

## Persistent notification

Android 14 and newer [no longer allow](https://developer.android.com/about/versions/14/behavior-changes-all#non-dismissable-notifications) regular apps to prevent notifications from being dismissed. If the persistent notification gets inadvertently dismissed, just open the app again and the notification will reappear.
Android 14 and newer [no longer allow](https://developer.android.com/about/versions/14/behavior-changes-all#non-dismissable-notifications) regular apps to prevent persistent notifications from being dismissed. To work around this, BasicSync will automatically show the persistent notification again whenever it is dismissed.

Alternatively, to prevent the notification from being dismissed, use adb to grant the `SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS` appops permission:
To prevent the notification from being dismissible in the first place (eliminating the UI jank from reshowing the notification), use adb to grant the `SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS` appops permission:

```bash
adb shell appops set com.chiller3.basicsync SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS allow
# To unfo the change, change "allow" to "default".
# To undo the change, change "allow" to "default".
```

Note that Syncthing will continue to run as normal even if the notification is not visible.
Also, if the persistent notification is not desired, it can be disabled from Android's settings by turning off the "Background services" notification category for BasicSync. Syncthing will continue to run as normal even if the notification is not visible.

## Verifying digital signatures

Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/com/chiller3/basicsync/Notifications.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ class Notifications(private val context: Context) {
)
setContentIntent(primaryPendingIntent)

val onDismissIntent = SyncthingService.createIntent(
context,
SyncthingService.ACTION_RENOTIFY,
)
val onDismissPendingIntent = PendingIntent.getService(
context,
0,
onDismissIntent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,
)
setDeleteIntent(onDismissPendingIntent)

// Inhibit 10-second delay when showing persistent notification
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE)
Expand Down