thanh-nguyen-kim/Unity_Android_Screen_Recorder

Cant use on Oculus

Opened this issue · 6 comments

uurha commented

Hi. I'm tying to record screen data from Oculus but all time receiving errors, do you have any suggestions.

AndroidManifest.txt

This is a bit modified AndroidManifest.

uurha commented

Also I use AndroidManifest from your project but it's not working ;-;

Oculus sdk might override default Unity Activity thus cause this bug. I will take a look but it may take time.

Hey! Any updates on this? I am also interested! Thanks!

I was able to make it work on Oculus but it now gives me an exception when starting the service:
Error Unity AndroidJavaException: java.lang.IllegalStateException: System services not available to Activities before onCreate()
Error Unity java.lang.IllegalStateException: System services not available to Activities before onCreate()
Error Unity at android.app.Activity.getSystemService(Activity.java:6655)
Error Unity at com.setik.androidutils.AndroidUtils.startRecording(AndroidUtils.java:137)

The sample is assuming that the main Activity is the AndroidUtils one and parts of the code is using this assumption, like:

androidRecorder = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
androidRecorder.Call("setUpSaveFolder","Tee");

Update: after renaming the main activity in the manifest com.setik.androidutils.AndroidUtils, I got this error:
AndroidJavaException: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.systemui/com.android.systemui.media.MediaProjectionPermissionActivity}; have you declared this activity in your AndroidManifest.xml?

Apparently, the oculus android flavor handles these permissions differently (VR mode only).
https://forums.oculusvr.com/t5/Oculus-Quest-Development/Problem-with-MediaProjection-and-permission-dialog/m-p/874818

@eusebiu Did you able to record with audio ? I am looking for same ...

Nope, gave up!