Accessing local files — Oculus
IMPORTANT:

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible: https://developer.oculus.com/quest-pitch/

For additional information and context, please see "Submitting Your App to the Oculus Quest Store".
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Accessing local files

RiddleSystemsRiddleSystems Posts: 8
NerveGear
edited July 16 in Oculus Quest Development
Hi all,

I'm looking to store video files locally on the Quest and access them from the apk through their file path.

To be clear, I'm trying to access the internal storage on the Quest via an installed apk. This would be a video stored in the movies folder or something similar that can be viewed inside the Quest through the Gallery. I am aware that the file path of the apk is available and looks something like /storage/emulated/0/Android/data/com.company.name/files but this is not what I need.

I am aware of obb expansion files but we are simply using too many external files to fit inside the size constraints of an apk + obb (approx. 7GB). This app will not be pushed to the store either so I'm not worried about any of those constraints, we will hopefully be using the enterprise edition.

Any help would be greatly appreciated!

EDIT: Solved

Comments

  • cnn_idcnn_id Posts: 8
    NerveGear
    edited July 10
    Hi. RiddleSystem.
    Try use path /sdcard/my_folder/my_file
    And don't forget about permissions: READ/WRITE in AndroidManifest.xml
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    If I am correct understood You .)
  • RiddleSystemsRiddleSystems Posts: 8
    NerveGear
    Thanks for your response.

    Yes, sorry, I did forget to mention that I've updated the android manifest with those permissions. 

    Unfortunately the sdcard path doesn't seem to work either, does the Quest definitely use the same path as the Go?

    I've tried a path similar to the first one because it made sense with the file structure you can see when you connect the Quest to a computer: "/storage/emulated/0/Movies/file.mp4". I'm really running out of ideas here, I feel like there is a simple solution that I'm missing :(
  • cnn_idcnn_id Posts: 8
    NerveGear
    edited July 12
    Hi.
    This is strange.
    Make sure after install app permissions: WRITE/READ are granted
    adb shell dumpsys package <package_name>
    And check sections:
    requested permissions:
    install permissions:
    android.permission.READ_EXTERNAL_STORAGE: granted=true
    runtime permissions:

    If granted=false 
    adb shell pm grant <package_name> android.permission.READ_EXTERNAL_STORAGE
    adb shell pm grant <package_name> android.permission.WRITE_EXTERNAL_STORAGE

    And check again:
    adb shell dumpsys package <package_name>

    For my apps used path /sdcard/my_folder and read/write files work perfect on Oculus Go / Quest.
  • RiddleSystemsRiddleSystems Posts: 8
    NerveGear
    That was it! 

    Thank you so much for your help! That was driving me crazy.

    Before I manually grant read/write permissions the dumpsys says
    requested permissions:
    android.permission.WRITE_EXTERNAL_STORAGE
    android.permission.READ_EXTERNAL_STORAGE

    If I'm requesting permission but it's not being granted does this mean that my android manifest is incorrectly set up ? 

    Here's what my manifest looks like: 

    <?xml version="1.0" encoding="utf-8"?><manifest    xmlns:android="http://schemas.android.com/apk/res/android"    package="com.unity3d.player"    xmlns:tools="http://schemas.android.com/tools"    android:installLocation="preferExternal">    <supports-screens        android:smallScreens="true"        android:normalScreens="true"        android:largeScreens="true"        android:xlargeScreens="true"        android:anyDensity="true"/>    <application        android:theme="@style/UnityThemeSelector"        android:icon="@mipmap/app_icon"        android:label="@string/app_name">        <activity android:name="com.unity3d.player.UnityPlayerActivity"                  android:label="@string/app_name">            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />        </activity>    </application>   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    </manifest>
    This is in the Plugins/Android folder in the Unity project that is merged with Unity's default manifest. 

    Thanks again for your help!
Sign In or Register to comment.