KasemJaffer / receive_sharing_intent

A Flutter plugin that enables flutter apps to receive sharing photos, text and url from other apps.
Apache License 2.0
321 stars 369 forks source link

Receiving text opens inside another app on some devices #299

Open marekhalmo opened 2 months ago

marekhalmo commented 2 months ago

Consider an application which stores your copy text stack. The app would receive share text intent and add it to the app's list.

User would go to app A (let's say a browser).. select text, share it to this app (B). Text would be added to the list inside of app (B)

On some devices -> my app (B) opens inside the app (A) - insade task of A

What i want it to do is to push the data to an already running instance of app (B).

I tried to put singleTop, singleInstance e.t.c. to AndroidManifest but no luck.

It works on Android Emulator for Pixel3a (Android 14), and my Android 8 tablet, but does not work on all other real android devices that i own < Android 13, 10, 11

Any idea why?

marekhalmo commented 2 months ago

Application i start it with is always chrome - address bar

marekhalmo commented 2 months ago

New information

It seems like where it goes OK, it comes from ReceiveSharingIntent.getTextStream() listener - when the app was already opened before, or ReceiveSharingIntent.getTextStream() if it was not opened

If my app (B) opens inside of (A) - the event commes from ReceiveSharingIntent.getTextStream() future - every time

marekhalmo commented 2 months ago

Looks like the problem is that when it works -> the intent is started with "startActivity" vs if it does not it is launched with "startActivityWithResult"