mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-25 07:03:35 +00:00
211c29e8c2
As of v51, Quest works with the official OpenXR loader.
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package @ANDROID_PACKAGE@;
|
|
|
|
import android.Manifest;
|
|
import android.app.NativeActivity;
|
|
import android.content.pm.PackageManager;
|
|
import android.util.Log;
|
|
import android.os.Build;
|
|
|
|
public class Activity extends NativeActivity {
|
|
static {
|
|
if (Build.MANUFACTURER.contains("Pico")) {
|
|
Log.d("LOVR", "Using Pico OpenXR Loader");
|
|
System.loadLibrary("openxr_loader_pico");
|
|
} else {
|
|
Log.d("LOVR", "Using Generic OpenXR Loader");
|
|
System.loadLibrary("openxr_loader_generic");
|
|
}
|
|
System.loadLibrary("lovr");
|
|
}
|
|
|
|
protected native void lovrPermissionEvent(int permission, boolean granted);
|
|
|
|
@Override
|
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
|
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
lovrPermissionEvent(0, true);
|
|
} else {
|
|
lovrPermissionEvent(0, false);
|
|
}
|
|
}
|
|
|
|
private void requestAudioCapturePermission() {
|
|
if (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
|
requestPermissions(new String[] { Manifest.permission.RECORD_AUDIO }, 1);
|
|
} else {
|
|
lovrPermissionEvent(0, true);
|
|
}
|
|
}
|
|
}
|