Quantcast
Channel: Tutorials – Unity Coding – Unity3D
Viewing all articles
Browse latest Browse all 58

Read File from Oculus Quest /sdcard/ Folder

$
0
0

Solution:
– Place your file into some sdcard folder (by browsing there with Explorer), for example:”This PC\Quest\Internal shared storage\Download\myfile.txt”
– Add script to load file:
var t = File.ReadAllText("/sdcard/Download/myfile.txt");
– From Unity menu select: Oculus/Tools/Create store-compatible AndroidManifest.xml
– Modify Assets/Plugin/Android/AndroidManifest.xml, add this line after </application> :
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
– Build & Run *Note: run fails, due to missing launch action.. so run the app manually in device (from library/unknown sources)
– Allow Read permissions when you start the app

Optional:
– You can enable LAUNCHER, to make Build & Run work, by replacing this line:
<category android:name="android.intent.category.INFO"/>
with:
<category android:name="android.intent.category.LAUNCHER"/>
– Can also disable permission request (while doing tests), by modifying this line:
meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false"
into:
meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"
– Can also add Write permissions:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

My AndroidManifest.xml:
https://gist.github.com/unitycoder/a8a827311ea0837b06af6ccde85effec

My Build Settings for Install location and Write Permissions (they don’t seem to affect much?)

Resources:
https://developer.oculus.com/distribute/latest/concepts/publish-mobile-manifest/
https://forums.oculusvr.com/developer/discussion/78412/accessing-local-files


Viewing all articles
Browse latest Browse all 58

Trending Articles