-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
App crash in Android 14 #1631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
call this method Helper.requestCapturePermission() before navigator.mediaDevices.getDisplayMedia |
Thank you @Diya-Yi |
Not working after set targetSdversion to 34 Failed to handle method call |
When I do a fresh install and then
then gives error but after restart again then it works properly. Looks like android is not listening permission properly without hard reload. |
@Diya-Yi can you please help here? |
Also now it shows me 2 popups to start recording after adding |
hi @harshmdr-devslane, Add this in your AndroidManifest.xml <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"/> Before call final isGranted = await Helper.requestCapturePermission();
if (!isGranted) return; |
I am using the same code and I have got isGranted is true after allow but fails |
I am using android Emulator so may be the reason of it. I will try in real device and then let you know. |
@lambiengcode Not working first time only. |
final isGranted = await Helper.requestCapturePermission();
if (!isGranted) return;
// start foreground service
var stream = await navigator.mediaDevices.getDisplayMedia({ Have you started the foreground service yet? @harshmdr-devslane |
yes, i have stared foreground service using |
Is the sequence matters?
|
I changed the sequence but still same result. Not working for first time. |
This error is because Android 14 requires <service
android:name="de.julianassmann.flutter_background.IsolateHolderService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaProjection" /> |
Hi @victortive |
Anyone who has found the solution? |
Hi there, I just solved a similar issue and stumbled over this issue
Yes, ordering matters, you need to first request capture permission, then start the foreground service (and then do whatever you do, getDisplayMedia in this case) According to the docs, the "standard" permission needs to be granted before attemping to use the foreground permission.
|
For any viewers, this is what you must do to share your screen on Android 14+.
|
But this is not working on Android 14 and 15 . it is Only working when you force your targetsdk to 28 . But this is not good when you publishing your App in google console. Becuz Google play console want taget sdk 33+. And Also what is your requestCapturePermission() , when i added this Permission it throw me error . |
E/AndroidRuntime( 7187): java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
I am using flutter_webrtc: 0.9.27.
var stream = await navigator.mediaDevices.getDisplayMedia({
'video': {'deviceId': 'broadcast'},
'audio': false
});
Any solution?
The text was updated successfully, but these errors were encountered: