plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

Unable to share image in Redmi device

Open adnankhan74444 opened this issue 3 years ago • 7 comments

Platform

Android 10

Plugin

share_plus

Version

share_plus 4.0.10+1

Flutter SDK

3.0.5

Steps to reproduce

Screen Shot 2022-09-06 at 10 11 26 AM

Code Sample

try {
      var boundary =
          widgetKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
      // if it needs repaint, we paint it.
      //if (boundary.debugNeedsPaint) {}
      var image = await boundary.toImage(pixelRatio: 3.0);
      var byteData = (await image.toByteData(format: ImageByteFormat.png))!;
      var pngBytes = byteData.buffer.asUint8List();
      final tempDirPath = (await getTemporaryDirectory()).path;
      final file = await File('$tempDirPath/image.png').create();
      await file.writeAsBytes(pngBytes);
      paths.add(file.path);
      await Share.shareFiles(
        paths,
        mimeTypes: ['image/png'],
        subject: subject,
        text: text,
      ); //subject,

    } catch (e) {
     print(e.toString());
    }

Logs

Facing issue when share image to REDMI device as you can see the attached image.

Flutter Doctor

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.3.1 21E258 darwin-x64, locale en-QA)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

adnankhan74444 avatar Sep 06 '22 07:09 adnankhan74444

Hi @adnankhan74444 could you check if:

  • this issue happens with other files
  • this issue happens when sharing with other apps (e.g. Telegram?)
  • this issue happens when implementing the share intent natively on Android (if you have enough Android experience to try that)

thanks!

miquelbeltran avatar Sep 07 '22 15:09 miquelbeltran

Hi @miquelbeltran

But the same code and same scenario is working fine on other devices (Samsung and Iphone), this issue is only happening in REDMI device.

adnankhan74444 avatar Sep 07 '22 16:09 adnankhan74444

Hi @miquelbeltran I am also facing this issue just for Redmi device. When i try to attach file with Redmi device file is not attaching with gmail. Same error i am geeting.

Error : can't attach file

Sajeel0327 avatar Sep 12 '22 12:09 Sajeel0327

Hi

I am also facing same issue with this device type, can you please look into this issue

Thanks Chora

chorauoc avatar Sep 12 '22 12:09 chorauoc

Hi I am also facing same issue with this device type, can you please look into this issue

Avinash-kommareddy avatar Sep 12 '22 13:09 Avinash-kommareddy

Feel free to try to debug the issue and figure out what is wrong, since you also own this device. If you send a PR with the fix I will review and merge asap, but don't expect me to work on it.

miquelbeltran avatar Sep 12 '22 15:09 miquelbeltran

I'm also facing same issue, any one solved yet or not.

usmanmushtaq97 avatar Sep 14 '22 06:09 usmanmushtaq97

To resolve the issue we need proper logs instead of what the author of the issue wrote in Logs section. Also don't have Redmi device, so can't check the problem.

vbuberen avatar Sep 28 '22 07:09 vbuberen

I have a Xiaomi device and would be happy to test this in the beginning of October (and maybe even fix it as part of Hacktoberfest). I will let you know as soon as possible if I can reproduce this error on my device.

ThexXTURBOXx avatar Sep 28 '22 13:09 ThexXTURBOXx

I have tested it and it does not seem to be reproducible on my Xiaomi Mi 9T Pro. So, sadly, I cannot fix this, I am sorry.

ThexXTURBOXx avatar Oct 03 '22 14:10 ThexXTURBOXx

I have done this for other app like what's app.

Amanvein avatar Oct 08 '22 14:10 Amanvein

Hi there, while I don't have any Android device at all, I am very familiar with our implementation for Android. When we share files on Android, we first stash them in a cache directory to grant other applications access to them. If I were to investigate this issue (which I can't) that's where I would look first :)

Coronon avatar Oct 29 '22 00:10 Coronon

@adnankhan74444 Could you share the logs from flutter run?

davidmartos96 avatar Nov 29 '22 14:11 davidmartos96

After talking with an user who was experiencing this issue it looks like disabling MIUI optimizations solves the problem. Still, it would be good to have some logs to see if is viable to fix in the plugin's side.

image

davidmartos96 avatar Nov 29 '22 16:11 davidmartos96

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Feb 28 '23 00:02 github-actions[bot]

This issue still exists

davidmartos96 avatar Feb 28 '23 06:02 davidmartos96

Without meaningful logs we won't be able to help. Also, having experience with Xiaomi specific bugs some years ago when I was doing only Android, I believe, there still be a set of Xiaomi/Redmi devices for which it won't be possible to fix the issue.

vbuberen avatar Feb 28 '23 20:02 vbuberen

@vbuberen Yes, it would be great if someone that can reproduce the issue could share some logs.

I don't think it should be closed for inactivity though, someone may encounter with this and share a PR with a fix.

davidmartos96 avatar Feb 28 '23 20:02 davidmartos96

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar May 31 '23 00:05 github-actions[bot]