Isvisoft / flutter_screen_recording

A new Flutter plugin for record the screen.
MIT License
142 stars 138 forks source link

After integrating in to native app, not working on Android #67

Closed praveenb closed 2 years ago

praveenb commented 2 years ago

Hi,

To use this plugin, I faced few issues like below

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
        at android.content.ComponentName.<init>(ComponentName.java:131)
        at android.content.Intent.<init>(Intent.java:6535)
        at changjoopark.com.flutter_foreground_plugin.FlutterForegroundPlugin.launchForegroundService(FlutterForegroundPlugin.java:94)

after fixing this issue, got another issue Video size issue.

after fixing this issue, got another issue open failed: EACCES (Permission denied)

after fixing this issue, got another issue

java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
E/AndroidRuntime(11286):    at android.os.Parcel.createException(Parcel.java:2074)
E/AndroidRuntime(11286):    at android.os.Parcel.readException(Parcel.java:2042)
E/AndroidRuntime(11286):    at android.os.Parcel.readException(Parcel.java:1990)

after resolving this issue, Im able to use this plugin in Flutter app

But the same not working after integrating Flutter code in to Native app.

Issue seems happening onActivityResult of native Activity screen. Please need help on it.

praveenb commented 2 years ago

Fianlly, Got it fixed by using below method call onActivityResult of Native activity screen.

flutterFragment.onActivityResult(requestCode, resultCode, data);

Thanks