-
Notifications
You must be signed in to change notification settings - Fork 72
Description
When sharing an image from the gallery, everything works correctly: getInitialSharedMedia() returns the shared media, and resetInitialSharedMedia() is called to clear it.
However, if the app is sent to the background and then killed by the OS (or manually using adb shell am kill my.package), the previously handled media is returned again when the app is relaunched.
This leads to the same media being processed a second time, even though resetInitialSharedMedia() was called.
Steps to reproduce:
- Share an image from the gallery to the app.
- Handle the media like this:
var media = await ShareHandlerPlatform.instance.getInitialSharedMedia();
if (media != null) {
ShareHandlerPlatform.instance.resetInitialSharedMedia();
// logic here
}
- Minimize the app (put it in background).
- Simulate app kill using:
adb shell am kill my.package - Relaunch the app.
Unexpected behavior:
getInitialSharedMedia() returns the same media again, even though it was previously reset.
Expected behavior:
Once resetInitialSharedMedia() is called, the media should not persist across app restarts or be returned again.
Environment:
- Plugin version: share_handler: ^0.0.25
- Platform: Android
- Tested in release and debug mode
Thanks for your support and great work on the plugin!