thanh-nguyen-kim / Unity_Android_Screen_Recorder

A simpler demo record screen plugin for record Android Screen
GNU General Public License v3.0
101 stars 36 forks source link

Cant use on Oculus #16

Open uurha opened 3 years ago

uurha commented 3 years ago

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 3 years ago

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

thanh-nguyen-kim commented 3 years ago

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

eusebiu commented 3 years ago

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

eusebiu commented 3 years ago

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

ti-hardikshah commented 2 years ago

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

eusebiu commented 2 years ago

Nope, gave up!