8000 [BUG] java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION · Issue #92 · JulianAssmann/flutter_background · GitHub
[go: up one dir, main page]

Skip to content
[BUG] java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION #92
@iAbdulaziz93

Description

@iAbdulaziz93

Describe the bug
I'm trying to share the screen on a real device, the below error message is showing without crashing the app, but the share function is not working.

To Reproduce
I'm using the share feature that livekit_client package is offering by using flutter_background package. I followed both packages' steps/docs to enable this feature.

Expected behavior
The share screen feature is working as expected without issues.

Smartphone:

  • Device: Honor Pad X9 (Tablet)
  • OS: MagicOS 7.1 (Android 13)
Logs
[+11035 ms] E/RtgSchedIpcFile(26586): RtgSchedIpcFile failed to open /proc/26586/rtg
[        ] I/RmeSchedManager(26586): init Rme, version is: v1.0
[        ] E/RtgSchedIpcFile(26586): setCommandByIoctl not opened
[        ] D/RtgSched(26586): resetRtgSchedHandle failed enable:0
[   +7 ms] I/VRI[MainActivity](26586): send MSG_WINDOW_FOCUS_CHAN
8D7B
GED msg
[   +1 ms] I/PointerIcon(26586): Pointer cache recompute key = com.example
[        ] D/DecorView(26586): showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
[  +31 ms] I/SurfaceControl(26586): SurfaceControl 0xb400007d6a93c220
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007de00893c0 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007de00893c0
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007d7b881540 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d7b881540
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007d7bae1220 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d7bae1220
[ +965 ms] D/ActivityThread(26586): Won't deliver top position change in state=4
[   +7 ms] I/SurfaceControl(26586): SurfaceControl 0xb400007d55839ae0
[        ] I/SurfaceControl(26586): SurfaceControl 0xb400007de008c660
[        ] I/SurfaceControl(26586): SurfaceControl 0xb400007d6a93ff60
[   +3 ms] I/DecorView[](26586): set decor visibility 0
[   +1 ms] I/SurfaceControl(26586): nativeRelease 0xb400007d6a93c220 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d6a93c220
[   +7 ms] I/org.webrtc.Logging(26586): EglBase14Impl: Using OpenGL ES version 2
[   +2 ms] I/BufferQueueConsumer(26586): [](id:67da00000004,api:0,p:-1,c:26586) connect: controlledByApp=true
[   +3 ms] E/MethodChannel#FlutterWebRTC.Method(26586): Failed to handle method call
[        ] E/MethodChannel#FlutterWebRTC.Method(26586): java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Parcel.createExceptionOrNull(Parcel.java:3022)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Parcel.createException(Parcel.java:3006)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Parcel.readException(Parcel.java:2989)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Parcel.readException(Parcel.java:2931)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:268)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.media.projection.MediaProjection.<init>(MediaProjection.java:81)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:134)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.cloudwebrtc.webrtc.OrientationAwareScreenCapturer.startCapture(OrientationAwareScreenCapturer.java:123)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.cloudwebrtc.webrtc.GetUserMediaImpl.getDisplayMedia(GetUserMediaImpl.java:560)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.cloudwebrtc.webrtc.GetUserMediaImpl.getDisplayMedia(GetUserMediaImpl.java:512)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.cloudwebrtc.webrtc.MethodCallHandlerImpl.getDisplayMedia(MethodCallHandlerImpl.java:1404)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.cloudwebrtc.webrtc.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:634)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Handler.handleCallback(Handler.java:971)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Handler.dispatchMessage(Handler.java:107)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Looper.loopOnce(Looper.java:206)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Looper.loop(Looper.java:296)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.app.ActivityThread.main(ActivityThread.java:9205)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at java.lang.reflect.Method.invoke(Native Method)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1027)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586): Caused by: android.os.RemoteException: Remote stack trace:
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:579)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:163)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Binder.execTransactInternal(Binder.java:1318)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586):         at android.os.Binder.execTransact(Binder.java:1279)
[        ] E/MethodChannel#FlutterWebRTC.Method(26586): callee: null 1782/4379
[        ] E/MethodChannel#FlutterWebRTC.Method(26586): 
[        ] I/VRI[MainActivity](26586): send MSG_WINDOW_FOCUS_CHANGED msg
[   +3 ms] I/SurfaceControl(26586): SurfaceControl 0xb400007d6a93c220
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007d6a93d940 count: 4
[        ] I/SurfaceControl(26586): SurfaceControl 0xb400007d7bae1220
[        ] I/SurfaceControl(26586): SurfaceControl 0xb400007dd6eadb00
[        ] I/SurfaceControl(26586): SurfaceControl 0xb400007d6a93d800
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007d55839ae0 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d55839ae0
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007d6a93ff60 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d6a93ff60
[        ] I/SurfaceControl(26586): nativeRelease 0xb400007de008c660 count: 2
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007de008c660
[        ] I/SurfaceControl(26586): ~SurfaceControl 0xb400007d6a93d940
[   +3 ms] E/RtgSchedIpcFile(26586): RtgSchedIpcFile failed to open /proc/26586/rtg
[        ] I/RmeSchedManager(26586): init Rme, version is: v1.0
[        ] E/RtgSchedIpcFile(26586): setCommandByIoctl not opened
[        ] D/RtgSched(26586): resetRtgSchedHandle failed enable:1
[        ] I/PointerIcon(26586): Pointer cache recompute key = com.example
[        ] D/DecorView(26586): showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
[        ] W/InputMethodManager(26586): startInputReason = 1
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.6.1 23G93 darwin-arm64, locale en-SA)
    • Flutter version 3.24.1 on channel stable at /Users/abdulaziz/Dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (8 days ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/abdulaziz/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.92.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)            
    • ELN L09 (mobile)                • ADYX9X4205G01117      • android-arm64  • Android 13 (API 33)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 128.0.6613.85
    ! Error: Browsing on the local area network for ‏iPhone ‏عز. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0