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
325 stars 372 forks source link

Sharing a text after killed by system returns previous shared text #228

Open bbig979 opened 2 years ago

bbig979 commented 2 years ago

Hi all, I encountered this issue and spent days on it. I hope some of people have insight for this.

I setup receive_sharing_intent for text sharing and made it work perfect. I tested all possible scenario and it worked fine. However I discovered this one case where this plugin fails.

Let's say I share text A to my app => my app is killed by system for memory management => share text B to my app, then what I get is text A instead of text B. You can reproduce killed by system following direction in this link (https://stackoverflow.com/questions/5287237/simulate-killing-of-activity-in-emulator) I use developer option method in the link.

Anyone has a solution to case?

Update: I noticed that this happens when I set android:launchMode="singleTask" ( I need to set this, otherwise it makes lots of duplicated apps in background app list )

Update: I made a repo to demonstrate this: https://github.com/bbig979/intent_bug

Update: I attached a screen recording how to reproduce this

intent_bug (3)

bbig979 commented 2 years ago

Found a solution

Just pass true in this line: https://github.com/KasemJaffer/receive_sharing_intent/blob/master/android/src/main/kotlin/com/kasem/receive_sharing_intent/ReceiveSharingIntentPlugin.kt#L236