MeshCentral: Android client crashing when connecting to desktop view
When connecting to POCO F2 Pro (Android 11) in desktop tab this happens:
java.lang.RuntimeException: Unable to start service com.meshcentral.agent.ScreenCaptureService@6f91396 with Intent { cmp=com.meshcentral.agent2/com.meshcentral.agent.ScreenCaptureService (has extras) }: java.lang.UnsupportedOperationException: Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display. at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4409) at android.app.ActivityThread.access$1900(ActivityThread.java:246) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1993) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:7876) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Caused by: java.lang.UnsupportedOperationException: Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display. at android.app.ContextImpl.getDisplay(ContextImpl.java:2497) at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1015) at com.meshcentral.agent.ScreenCaptureService.startProjection(ScreenCaptureService.kt:188) at com.meshcentral.agent.ScreenCaptureService.onStartCommand(ScreenCaptureService.kt:169) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4386) ... 8 more
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (19 by maintainers)
Maybe this is the same issue:
I tested on a Samsung Galaxy Tab S5e running LineageOS 17.1 (Android 10) and a Samsung Galaxy S9 running LineageOS 16 (Android 9). When connecting desktop, both devides ask for permission. If granted, both devices say the screen is being shared (showing a screensharing icon) and for both devices the desktop states “Connected”, but the window stays black. No error message is emitted.
adb logcat
emits multiple identical lines ofper second while screen sharing is active (this is from the Tab S5e).
Both screen sharing with my TV or Laser TV using Miracast, which seems to use the same capturing function, works well for both devices. adb based screen sharing, e.g. using scrcpy, work well, too.
Desktop View is now working on my Galaxy S10+!!!
@petervanv Interesting. Thanks for pointing that out.
Earlier i had an other tool (tested) it called (in google playstore) deel scherm, i did that a long time ago, so maybe you could look at that one too --) https://play.google.com/store/apps/details?id=nfo.oneassist&hl=nl&gl=US
It doesn’t crash! It does show what’s on the screen properly! But input is not working. Clicking the mouse doesn’t do anything nor does typing or sending text to type.
Google Play does report the Android Agent crashes and I think it’s correct that it does not work on Android 11. I don’t have a Android 11 device myself, but Bryan does. Based on the Google Play crash logs, I may be able to work something out.
The most frequent crash reported on GooglePlay is:
The important part is “getDisplay()” does not exist. Will work on this…
Server 0.7.87. Android Agent v1.0.7 crashes on both Samsung S10e and S9+ when trying to use desktop feature. However, it works flawlessly for the “Files” function
I can confirm the screen sharing is not working on Android Version 11. I have tested on a Galaxy S21 Ultra and on a Galaxy Note10 Plus. Also tried multiple browsers. I receive the prompt on Android saying, “Start recording or casting with MeshCentral Agent?”. I press button “Start Now” and it crashes. I have updated server to 0.7.86 and updated the Android application.
0.7.86 confirmed to work for my devices! That is great, thank you!
Though the MC tab in Firefox crashed once when playing video. 😉
I can not confirm its working, updated to version on my SM-T310, version of meshcentral: 0.7.86
I think we’re close to figuring it out. The black screen seems to be related to the multiplexor on the server. It also seems to crash on Android 11. Once I get more cycles I’ll be able to help out on the android agent as I have way more devices than Ylian does. I literally have a drawer full of phones going all the way back to the nexus s, lol.