question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Companion App Shortcut spawns new recent app

See original GitHub issue

Home Assistant Android version: 2022.3.0-full

Android version: 12

Phone model: Samsung Galaxy S20 5G

Home Assistant version: 2022.2.9

Last working Home Assistant release (if known): N/A

**Description of problem: When launching the app from a shortcut, a new copy of the app is displayed in recent apps. In trying to ensure the phone does not kill the app in the background, I have selected “Keep Open” from the options in recent apps. This now means that every time I launch the app from a shortcut, it creates a new, locked, copy in my recent apps. **

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs): N/A


Screenshot of problem: Screenshot_20220407-000203_One UI Home

Additional information:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
CKerswellcommented, Apr 7, 2022

Thanks for your prompt reply.

I use Nova Launcher, tried switching to the default Samsung launcher and experience the same behaviour.

Also tested a fresh install on a Xiaomi Mi5 using Android 8 and exhibits the same behaviour, so it does look to be app related as opposed to device related.

0reactions
dshokouhicommented, Apr 7, 2022

It looks like it would be possible to retain both behaviours by using a combination of android:documentLaunchMode / finishAndRemoveTask() /

finishAndRemoveTask() will not work here because the same activity is used when the app is launched and there are other places that open webview instead of just the shortcuts. Also it needs to be called from an activity but shortcuts launch activities, they are not an activity themselves.

android:maxRecents.

This does not work, I tested it myself and it does not respect this value

None of the options are viable for us here, as this activity is a webview activity we have things to workaround some of the odd quirks when it comes to multiple shortcuts. The only option that may be viable would be to exclude the screen completely from recents but I also suspect that wont be nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Shortcuts - Home Assistant Companion Docs
These shortcuts need to be added from Companion App in Settings so users can drag them on their home screen after long pressing...
Read more >
Spawning multiple instances of applications via shortcuts
To open another instance of the app, use the -n option with open. ... execute this and then a keyboard shortcut for the...
Read more >
Central for DayZ - Map & Guide - Apps on Google Play
Central for DayZ aims to bring together quality information, maps and guides created by the DayZ community, all packaged into a fast, polished...
Read more >
Android Application Launch explained: from Zygote to your ...
It stats listening on a socket interface for future requests to spawn off new virtual machines (VM)for managing new application processes.
Read more >
Usage guide - GrapheneOS
Opening an app with the recent apps activity will place it on the furthest right in the recent apps order just like a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found