Comments (8)
After adding this line, android:foregroundServiceType="mediaProjection"
now it's working.
Add it here: <service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection"/>
AndroidManefist.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kukustudio.textcrawler">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk
android:minSdkVersion="23"
tools:overrideLibrary="changjoopark.com.flutter_foreground_plugin" />
<application
android:label="Star Crawler"
android:icon="@mipmap/launcher_icon">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!--
Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI.
-->
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<!--
Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame.
-->
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection"/>
<!--
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
-->
<meta-data android:name="flutterEmbedding" android:value="2" />
</application>
</manifest>
from flutter_screen_recording.
This plugin use https://pub.dev/packages/flutter_foreground_plugin for that. You have to follow the instruccions and add the configuration to your AndroidManifest
from flutter_screen_recording.
Thanks for replying. I know that and i add the configuration to my AndroidManifest but still app crash when click on start record button in compileSdkVersion 29 and targetSdkVersion 29. I checked your example too which is running compileSdkVersion 28 and targetSdkVersion 28, please change it to 29 and see by yourself.
from flutter_screen_recording.
Please reopen the issue until it is fixed.
from flutter_screen_recording.
You made a great plugin but documentation should include these settings. It's so frustrating. It takes me more than 3 days to finally make it work. Thanks for the plugin.
from flutter_screen_recording.
After adding this line,
android:foregroundServiceType="mediaProjection"
now it's working.
Add it here:<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection"/>
AndroidManefist.xml<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.kukustudio.textcrawler"> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-sdk android:minSdkVersion="23" tools:overrideLibrary="changjoopark.com.flutter_foreground_plugin" /> <application android:label="Star Crawler" android:icon="@mipmap/launcher_icon"> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <!-- Specifies an Android theme to apply to this Activity as soon as the Android process has started. This theme is visible to the user while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /> <!-- Displays an Android View that continues showing the launch screen Drawable until Flutter paints its first frame, then this splash screen fades out. A splash screen is useful to avoid any visual gap between the end of Android's launch screen and the painting of Flutter's first frame. --> <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection"/> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> </manifest>
Thank you for helping, I got this problem too
from flutter_screen_recording.
Is it working for everyone?
I have done the exact same things, but it's not working for me. Please let me know.
Gives me the below error,
java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
E/AndroidRuntime( 5654): at android.app.ActivityThread.deliverResults(ActivityThread.java:5097)
E/AndroidRuntime( 5654): at android.app.ActivityThread.handleSendResult(ActivityThread.java:5138)
E/AndroidRuntime( 5654): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 5654): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 5654): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 5654): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
E/AndroidRuntime( 5654): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime( 5654): at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime( 5654): at android.app.ActivityThread.main(ActivityThread.java:7807)
E/AndroidRuntime( 5654): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5654): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime( 5654): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
E/AndroidRuntime( 5654): Caused by: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
E/AndroidRuntime( 5654): at android.os.Parcel.createException(Parcel.java:2088)
E/AndroidRuntime( 5654): at android.os.Parcel.readException(Parcel.java:2056)
E/AndroidRuntime( 5654): at android.os.Parcel.readException(Parcel.java:2004)
E/AndroidRuntime( 5654): at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:231)
E/AndroidRuntime( 5654): at android.media.projection.MediaProjection.<init>(MediaProjection.java:68)
E/AndroidRuntime( 5654): at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:147)
E/AndroidRuntime( 5654): at com.isvisoft.flutter_screen_recording.FlutterScreenRecordingPlugin.onActivityResult(FlutterScreenRecordingPlugin.kt:63)
E/AndroidRuntime( 5654): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:805)
E/AndroidRuntime( 5654): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:428)
E/AndroidRuntime( 5654): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:802)
E/AndroidRuntime( 5654): at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:724)
E/AndroidRuntime( 5654): at android.app.Activity.dispatchActivityResult(Activity.java:8292)
E/AndroidRuntime( 5654): at android.app.ActivityThread.deliverResults(ActivityThread.java:5090)
E/AndroidRuntime( 5654): ... 11 more
E/AndroidRuntime( 5654): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime( 5654): at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:501)
E/AndroidRuntime( 5654): at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
E/AndroidRuntime( 5654): at android.os.Binder.execTransactInternal(Binder.java:1021)
E/AndroidRuntime( 5654): at android.os.Binder.execTransact(Binder.java:994)
from flutter_screen_recording.
@deepak-ariceum
use this one in latest version
<service android:name="com.foregroundservice.ForegroundService" android:foregroundServiceType="mediaProjection"> </service>
instead of
<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:foregroundServiceType="mediaProjection"/>
from flutter_screen_recording.
Related Issues (20)
- flutter_screen_recording` uses a deprecated version of the Android embedding HOT 5
- Add support for Windows
- Deprecated Version Issue HOT 3
- zip END header not found. HOT 1
- how to get web dowloaded .webm file full path after stop recording HOT 1
- Not working in Flutter web release
- Latest Version HOT 1
- Unhandled Exception HOT 2
- [bug][iOS] Landscape orientation recording HOT 3
- Problem occured when running pub get with latest stable version of flutter 3.10.5 HOT 4
- Error onMethodCall startRecordScreen HOT 2
- Can't record sound of apps. HOT 2
- Screen recording when two user connect on call in app iOS HOT 1
- Can you add get file as byte and don't autosave file feature?
- On Android, it starts recording even before the 'start now' button is pressed on the native popup HOT 1
- The kotlin-gradle-plugin version is too low.
- Kotlin Gradle version is too low HOT 1
- Screen recorder fails on Android HOT 1
- deprecated version of the Android embedding warning!
- Can not record current Flutter tab on Web
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_screen_recording.