0

Is there a way to find out, if my Android App was opened by the launcher or by some third party app?

Something like this maybe? click

I am trying to build an app that can toggle torch. Which already works (I am new to Java and Android). But I want Bixby Button on my Samsung phone to open the app and then toggle torch automatically. Bixby is able to open a app since the newest version.

I found out, that if I open the app from the launcher and resume, it's the same instance. But if Bixby opens the app, it seems to be a new instance every time. And I don't want to use Availability Service to receive bixby button event.

kind regards

Schn3id3r
  • 1
  • 2

1 Answers1

0

@Vladyslav Matviienko, thank you for this link:

This seems to work:

protected void onResume() {
    super.onResume();
    Uri uri = this.getReferrer();
    if (uri==null) textView.append("Host: null");
    else textView.append("Host: " + uri.toString());
}

When opened by launcher, uri is "null", but when opened by bixby, it is "android-app://com.samsung.android.bixby.agent"

EDIT: On a second try launcher is "android-app://com.sec.android.app.launcher".

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
Schn3id3r
  • 1
  • 2