androidgalaxywearables

Galaxy watch 4 bringing application back to foreground (programmatically)


After porting Android application that previously ran on Wear OS to Galaxy watch 4 I came upon unexpected issue with bringing the application back to foreground after it was sent to background by pressing on the Home button. In Wear OS it was a simple matter of starting an empty activity while in background what returned the application back to the fore. In Galaxy watch 4 it doesn't work (probably due to new Google restrictions concerning opening activities while in background: https://developer.android.com/guide/components/activities/background-starts).

I was trying to resolve this issue by ambient mode but without success. So I would really appreciate any assistance in solving this: How can I bring application back to foreground programmatically in Galaxy watch 4?


Solution

  • the solution is requesting the following permission:

    android.permission.SYSTEM_ALERT_WINDOW
    

    This allows app overlay that in turn allows starting activities while app in BG