SecurityException when accessing Bluetooth API
I'm trying to access the Bluetooth API within a Unity project, but I end up with a SecurityException: 01-24 20:40:47.280 26380 26405 E Unity : AndroidJavaException: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10076 nor current process has android.permission.BLUETOOTH. 01-24 20:40:47.280 26380 26405 E Unity : java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10076 nor current process has android.permission.BLUETOOTH. 01-24 20:40:47.280 26380 26405 E Unity : at android.os.Parcel.readException(Parcel.java:1692) 01-24 20:40:47.280 26380 26405 E Unity : at android.os.Parcel.readException(Parcel.java:1645) 01-24 20:40:47.280 26380 26405 E Unity : at android.bluetooth.IBluetooth$Stub$Proxy.isEnabled(IBluetooth.java:864) 01-24 20:40:47.280 26380 26405 E Unity : at android.bluetooth.BluetoothAdapter.isEnabled(BluetoothAdapter.java:622) 01-24 20:40:47.280 26380 26405 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 01-24 20:40:47.280 26380 26405 E Unity : at com.unity3d.player.UnityPlayer.access$300(Unknown Source) 01-24 20:40:47.280 26380 26405 E Unity : at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source) 01-24 20:40:47.280 26380 26405 E Unity : at android.os.Handler.dispatchMessage(Handler.java:98) 01-24 20:40:47.280 26380 26405 E Unity : at android.os.Looper.loop(Looper.java:154) 01-24 20:40:47.280 26380 26405 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source) 01-24 20:40:47.280 26380 26405 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x0008d] in /Users/bokken/buildslave/unity/build/Modules/AndroidJNI/AndroidJNISafe However, my AndroidManifest.xml lists all required permissions: <?xml version="1.0" encoding="utf-8" standalone="no"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto"> <application android:label="@string/app_name" android:icon="@mipmap/app_icon" android:allowBackup="false"> <activity android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:excludeFromRecents="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.INFO" /> </intent-filter> <meta-data android:name="com.oculus.vr.focusaware" android:value="true" /> </activity> <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" /> <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only" /> <meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2" /> </application> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" /> </manifest> This is my simple test script which also asks for the FINE_LOCATION permission if necessary: void Start() { if (!Permission.HasUserAuthorizedPermission(Permission.FineLocation)) { Permission.RequestUserPermission(Permission.FineLocation); } else { AndroidJavaClass bluetooth = new AndroidJavaClass("android.bluetooth.BluetoothAdapter"); AndroidJavaObject bluetoothAdapter = bluetooth.CallStatic<AndroidJavaObject>("getDefaultAdapter"); if (!bluetoothAdapter.Call<bool>("isEnabled")) { bluetoothAdapter.Call<bool>("enable"); } AndroidJavaObject mBluetoothLeScanner = bluetoothAdapter.Call<AndroidJavaObject>("getBluetoothLeScanner"); ScanCallback scanCallback = new ScanCallback(); mBluetoothLeScanner.Call("startScan", scanCallback); } } Does anyone have success with accessing Bluetooth on the Quest from within a Unity project?11KViews1like13CommentsAndroid Permission Request Screen Text Not Appearing
We are using a less common Android permission request (REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) in order to support downloading multiple large 360 videos to the Quest 2 (total ~30GB). This permission request appears in a different UI to the standard permissions, and we are finding that it only appears correctly approx 50% of the time. The other 50% of the time the permission prompt background appears, but without the text or buttons. This is causing issues as without accepting this permission, our downloads will fail. Looks like this when text doesn't appear: Should look like this: Given the size of the download, the user will take the headset off whilst the download completes. We require this permission in order to prevent the device from entering doze or app standby and killing the app/download manager. There is no error or log message shown in logcat when the dialogue does not display correctly. We’ve attempted various methods of requesting this permission and it still only appears 50% of the time. It also seems to open the Oculus Dashboard menu, so the app can’t be interacted with until the Oculus button is pressed to close the dash. Ideally, we'd like it to appear in the standard permissions screen shown below, or to appear in the current UI but with the text showing every time. Any ideas?982Views1like0CommentsCasting from Q2 to phone on secondary account?
My partner is the Admin/primary account on the Quest 2. He can connect his phone on the app and cast just fine, so I can watch him play from his phone. But if I want to play on my account, the secondary, he can’t watch me play. We can’t cast via my account on either of our phones. Both my phone and the oculus can find each other on Bluetooth but it may not fully connect. The 5-digit code to connect was found in the About tab on the admin account, but entering this code on my account on my phone is only intended to cast the oculus to his phone on his account. From what I gather from troubleshooting, only the admin account can cast. We would love to suggest to make a way for the admin to give permission to allow the secondary account to cast so players can take turns watching each other play and we can guide each other learning to use game features.3.3KViews6likes3CommentsProblem with MediaProjection and permission dialog
Hi Im new to oculus development (Oculus Quest 2) and im trying simple app for making screenshots and screen recording. But im having a problem with permission to retrieve MediaProjectionApi I start activity for result, and the standard android dialog for permission shows but, but without allow/deny buttons, so im stuck. This is the dialog, sorry for the phone pic, but build in screenshot does not show this dialog. Found simmilar issue here https://github.com/rom1v/sndcpy/issues/75 but no solution either. My code for showing this dialog. This is in my MainActivity and the testMediaProjectionPermission method is call as onClickListener from a button. ActivityResultLauncher<Intent> resultLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult> () { @Override public void onActivityResult(ActivityResult result) { if(RESULT_OK == result.getResultCode()) { Log.d(TAG, "Media projection permission granted"); MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE); MediaProjection mediaProjection = mediaProjectionManager.getMediaProjection(result.getResultCode(), result.getData()); Log.d(TAG, "Successfully retrieved mediPerojeciton="+mediaProjection); } } }); private void testMediaProjectionPermission(View view) { MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE); resultLauncher.launch(mediaProjectionManager.createScreenCaptureIntent()); } Any advice would be appriciated. Any kind of workaround or another option to record screen other then the build in caster.Solved9.7KViews1like10CommentsNew Issue Accessing Expansion Files / AVPro video playback
I've had a new issue crop up in the last two weeks across multiple apps with videos failing to play. Previously everything worked fine. This has occurred in different apps after 1. Updating Oculus Integration to 28.0, and 2. Updating minimum Android build level to 23 The facts: Unity 2019.4.17f1 AVPro Video 1.x Have READ_EXTERNAL and WRITE_EXTERNAL in the manifest Calling videos from /sdcard/Android/obb/com.[org].[app]/ Have tried h.264, h.265, both as .mp4 and .mkv; have confirmed with videos I've gotten to play in other apps I've also gone into the app's Permissions in the Quest and though I requested Storage access in the manifest it was set to "Denied". Changed this to no effect. Does this have to do with the Oculus Native Video Player screwing with AVPro? Or is it a new permissions problem?Solved2.8KViews1like3CommentsQuest 2 screenshot in android apk made in Android studio
Hey, I have an issue with taking screenshots in an app that I made in Android Studio, I have tried several different permissions: WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, CAMERA, CAPTURE_VIDEO_OUTPUT, MEDIA_CONTENT_CONTROL, READ_FRAME_BUFFER, I have also tried removing the FLAG_SECURE but no matter what I try inside the Quest 2 headset I get the message "The developer has disabled taking photos in this app."1.2KViews0likes1CommentProblems with setting read permissions on Quest 2
I have an app developed in Unity3D that loads a 360 video from the "sdcard/Movies" folder. It is running fine on my Quest 1 but I can't get the permissions set correctly on my Quest 2. If I use "adb shell dumpsys package <package_name>" to check for the permissions it is listed as "android.permission.READ_EXTERNAL_STORAGE: restricted=true" Then I try to use the ADB command to change it "adb shell pm grant <package_name> android.permission.READ_EXTERNAL_STORAGE" But this doesn't change the restricted setting to granted=true as I would expect. I have also included the "<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>" in the Android manifest file. Is there something that I'm missing? Any help is apreciated. Eskild.Solved4.3KViews1like1CommentPACKAGE_USAGE_STATS permission not allowed on quest 2?
I am making an app that requires this permission. its a native android application so its not vr, doesnt use oculus sdk etc. The tool works fine on the regular quest, but when trying to open the activity to grant the permission on the quest 2, settings crashes. The crashing happens when clicking on the name of the app, to grant permissions for that app. crash log: 10-23 16:12:13.341 8723 8723 E AndroidRuntime: FATAL EXCEPTION: main 10-23 16:12:13.341 8723 8723 E AndroidRuntime: Process: com.android.settings, PID: 8723 10-23 16:12:13.341 8723 8723 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.SearchView.isIconified()' on a null object reference 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at com.android.settings.applications.manageapplications.ManageApplications.onSaveInstanceState(ManageApplications.java:511) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:2799) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at androidx.fragment.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManagerImpl.java:2276) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2335) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at androidx.fragment.app.FragmentController.saveAllState(FragmentController.java:151) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:513) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at com.android.settings.SettingsActivity.onSaveInstanceState(SettingsActivity.java:472) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.Activity.performSaveInstanceState(Activity.java:2037) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1485) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:5312) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4638) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4602) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4677) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:41) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2024) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7385) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 10-23 16:12:13.341 8723 8723 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Is this because this permission is blocked on the quest 2 or is this a possible bug?1.4KViews0likes2CommentsOpen socket permission denied in Unity project with Android native plugin C library
I am planing to use some network connections in a Unity project I plan developing for the Oculus quest. I created a simple project to get network communication working. The communication library is a native C library which is loaded using DllImport. The native C library access the network stack socket API. The project works fine on Windows however when I run it on the Quest I get the error: OS socket() failure, error 0XD: Permission denied Is there anything I have to do to set the right permissions? How to I get permissions to access the network stack socket API.1.3KViews0likes1CommentSharing UE4 Packages (non profit)
Hi, there Dear Oculus Quest World, Can I share My UE4 Packaged Build on my friend's Quest? I have managed to launch my test Unreal project on my quest, but I want my friend to test it on hers, is it possible? Or do I need to upload it to a store and get it signed and everything? Is it as easy as drag and drop? Their headset is in the developer mode as well and Unkwon sources is enabled! Basically do I have to publish it to the store and get it reviewed in order for my friend to see it on her Quest? apologize I should have posted this as a question not discussion! Really be psyched if this works, Thanks in advance.579Views0likes1Comment