1

My application's subscribing incoming ACTION_SEND data from another app.

It works as well when I shared a text from another app into my app. But in case of finishing my app then re-opening it from Recent tab, the ACTION_SEND data keep retaining.

I expected that shared data is cleared when my app is finished. How to resolve this?

This is my snippet code:

if (Intent.ACTION_SEND == action && type != null) {
    if ("text/plain" == type) {
        val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
        if (sharedText != null && URLUtil.isValidUrl(sharedText)) {
            sharedUrl = sharedText
        }
    }
}
Jenea Vranceanu
  • 4,530
  • 2
  • 18
  • 34
Huy Nguyen
  • 1,032
  • 14
  • 38

1 Answers1

1

You are seeing this phenomenon:

https://stackoverflow.com/a/19820057/769265

The linked question is related to "extras" in the Intent, but the behaviour is the same. I've explained what's happening and offered a few options to deal with the problem in the linked answer.

David Wasser
  • 93,459
  • 16
  • 209
  • 274