Skip to content

Android 10: Make SharePlugin usable again

Summary

Android 10 introduced restriction for background tasks. Because of that, the SharePlugin can no longer start activities when a URL is shared and KDE Connect is not in the foreground, rendering it nearly useless.

The Android documentation suggests to post a high-priority notification instead of starting an activity from the background so the user can decide themselves whether or not to start the activity.

This patch does exactly that: instead of trying (and failing) to start an activity from the background, it posts a notification. The patch applies to Android 10+ only, and only if KDE Connect is not running in the foreground. The behavior on lower Android versions is unchanged.

Test Plan

Before:

  1. Share a link with your Android device using your browser's Plasma Integration
  2. If KDE Connect is not in the foreground, nothing happens (on Android 10+)

After:

  1. Share a link with your Android device using your browser's Plasma Integration
  2. If KDE Connect is not in the foreground, a notification is posted allowing the user to open the link on their Android device (on Android 10+ only)

Merge request reports

Loading