flutter-moum/flutter_screenshot_callback

Screenshot Listener failed to listen on android sdk 29

Closed this issue · 9 comments

Hi, i tried this plugin on android sdk version 29. and seems like it's not working with addListener.
Working well with sdk 28. still not sure why this happened.

i have same issue, with this.
copied whole example.dart the addListener is not firing

I have same issue.

@dopefaceee

Thank you for opening the issue.

I tested my app with sdk 29. That test went well.

This plugin uses external storage permission. The permission must be approved.

May I ask you to check if the permission has been approved?

++ And I would appreciate if you test with the latest version ^1.1.5 !

@beygee I tested it on the physical devices and it doesn't work

D/SmartClipDataCropperImpl(29541): sendExtractionResultToSmartClipService : -- Extracted SmartClip data information --
D/SmartClipDataCropperImpl(29541): sendExtractionResultToSmartClipService : Request Id : 22
D/SmartClipDataCropperImpl(29541): sendExtractionResultToSmartClipService : Extraction mode : 1
D/SemSmartClipDataRepository(29541): ----- Start of SmartClip repository informations -----
D/SemSmartClipDataRepository(29541): ** Content type : image
D/SemSmartClipDataRepository(29541): ** Meta area rect : Rect(0, 0 - 0, 0)
D/SemSmartClipDataRepository(29541): ** Captured image file path : null
D/SemSmartClipDataRepository(29541): ----- End of SmartClip repository informations -----
D/SmartClipDataCropperImpl(29541): sendExtractionResultToSmartClipService : Elapsed = 2

I get this error in my Android when I try to take a screenshot. I just trying to print a message in the console.

Future<void> initScreenshotCallback() async {
    screenshotCallback = ScreenshotCallback();

    screenshotCallback.addListener(() {
      print('Take a PRINT');
    });
  }

My target SDK is the 29 too, in iOS works fine.

About the permision in storage I have, I can even download files in my app.

UPDATE:

I add the lines below:

await screenshotCallback.checkPermission();
    print('can take a PRINT? ${screenshotCallback.requestPermissions}');
    await screenshotCallback.initialize();

and receive this message:

I/flutter (29552): can take a PRINT? true
D/permissions_handler(29552): No permissions found in manifest for: 15

I try using SDK 28 and 29, and have the same result.

My Manifest have this permissions:

<uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.android.vending.BILLING" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

I fix it updating the permission_handler to 5.1.0+2 version in my own pubspec, I was using the 5.0.1+1.

You can also use this package from my repo where I did more fixes:

screenshot_callback:
    git:
      url: git://github.com/ousvat/flutter_screenshot_callback.git

Fixed 2.0.0.
Sorry for being late.