We are building an SDK that will take screenshots of an app once it is integrated. We are able to take screenshots for Native Android, Native iOS, Cordova, IONIC, React Native, Xamarin platforms. However unable to take a snapshot in V2 Flutter. The code was working fine until V1 Flutter as well. But when the same native code when executed on V2 Flutter returns a BLACK screenshot of the app.
The issue here is that V1's FlutterView was publicly available to third party plugins using a method called registrar.view(), in V2 this view is not exposed to any plugins now! https://api.flutter.dev/javadoc/io/flutter/plugin/common/PluginRegistry.Registrar.html Using V1's FlutterView we were able to capture the screenshot of the view(s) using PixelCopy, we are not able to get V2's FlutterView and we did not find any solution to capture that as well.
We have tried the following, but with no success. Can someone help me out here?
- Tried to get the activity from context we pass in our SDK initialization, we took view from activity and tried to paint it, blank screenshots being captured
- Tried to migrate the SDK Flutter Plugin to V2 using https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration
- Tried to traverse view hierarchy and paint the views using Activity context, blank screenshots being captured
- Tried to paint the view received from FlutterActivity.getWindow().getDecorView().getRootView(), blank screenshots being captured.