Jump to content

Access Focus 3 Local Storage


Fangh

Recommended Posts

Hello,

I am trying to access files on the local storage of the Focus 3, namely the Download, DCIM or any folder accessible when connecting the headset to a computer.

I am using the PermissionManager from the Wave SDK to request the permissions READ_EXTERNAL_STORAGE & WRITE_EXTERNAL_STORAGE (PermissionManager.instance.isPermissionGranted return true for both these permissions),

I also added the following lines in the AndroidManifest.xml

  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

 

but I get the following error when I try to access to the folder:

2022/01/19 18:42:26.516 7851 7893 Error Unity IOException: Permission denied
2022/01/19 18:42:26.516 7851 7893 Error Unity Rethrow as UnauthorizedAccessException: Access to the path '/storage/emulated/0/DCIM' is denied.
2022/01/19 18:42:26.516 7851 7893 Error Unity   at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00000] in <00000000000000000000000000000000>:0 
2022/01/19 18:42:26.516 7851 7893 Error Unity   at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00000] in <00000000000000000000000000000000>:0 
2022/01/19 18:42:26.516 7851 7893 Error Unity   at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <00000000000000000000000000000000>:0 
2022/01/19 18:42:26.516 7851 7893 Error Unity   at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00000] in <00000000000000000000000000000000>:0 
2022/01/19 18:42:26.516 7851 7893 Error Unity   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles (Syst

 

Has someone else succesfully access these folders? Am I missing something?

 

Thanks in advance for the help. @Alex_HTC

 

 

  • Like 1
Link to comment
Share on other sites

@Fangh Thanks for writing, we love feedback and questions for our developers!
This was a problem I ran into as well, and was surprised at the results. That seems to happen a lot during development - things make sense, there are just twists and turns that aren't reasonable to know before one dives in.

The answer is no and yes.

1) Developers cannot own files in the root sdcard (ie /storage/emulated/DCIM or /mnt/sdcard or /mnt/sdcard2 or /storage/ext_sd) due to a limitation in the android OS.
2) Developers can access files within a specified folder on the sdcard by requesting permissions through the android manifest and using the wave sdk to prompt the user to explicitly give access. 
An example project / branch is here:
https://github.com/hardcoded2/URP-Example/tree/sdcard 
The sdcard_root branch was a variation of this where I tried some additional ways of accessing, but seemed to make progress only when manually chmoding the files on my device through adb, a process that couldn't ship to end users.

with the example trying to write and read from the directory $"/mnt/sdcard/Android/data/{Application.identifier}/files/testingfoo"; in the file SampleInit.cs I beleive the variation of the path ar filePath = $"/storage/ext_sd/Android/data/{Application.identifier}/files/testingfoo"; should also work:

Thanks!
-Alex

  • Like 1
Link to comment
Share on other sites

I am not sure to understand.


The code I am using for this test (minus the use of PermissionManager) is working fine on an other Android device (tested on my phone). I can access the folder </storage/emulated/0>


I only have this "IOException: Permission denied" on Focus 3, presumably because I didn't set the permissions correctly even when the PermissionManager.instance.isPermissionGranted return true for READ_EXTERNAL_STORAGE & WRITE_EXTERNAL_STORAGE.
Does the limitation you speak of only impact the Focus 3 ?

Link to comment
Share on other sites

  • 3 months later...

Continuing this discussion a little:

Is there a good solution to save data from a VR simulation to an online repository? I'm thinking Google Docs, Dropbox, etc.? I am developing a simulation where we want to aggregate decisions people make. We are going to deploy on many headsets so we don't want to have to deal with local save files.

If you've come across a solution for this, please let me know.

Thank you!

Link to comment
Share on other sites

  • 1 month later...
On 1/21/2022 at 2:22 AM, Fangh said:

I am not sure to understand.


The code I am using for this test (minus the use of PermissionManager) is working fine on an other Android device (tested on my phone). I can access the folder </storage/emulated/0>


I only have this "IOException: Permission denied" on Focus 3, presumably because I didn't set the permissions correctly even when the PermissionManager.instance.isPermissionGranted return true for READ_EXTERNAL_STORAGE & WRITE_EXTERNAL_STORAGE.
Does the limitation you speak of only impact the Focus 3 ?

Permissionsmanager is a layer of security on focus3 devices that is not on android phones. https://hub.vive.com/storage/docs/en-us/NativePermissionManager.html
That is the reason it was suggested, as certain permissions need to be requested using the permissions manager

Link to comment
Share on other sites

  • 1 year later...

I am just starting to work with saving down .wav files and am just now going to implement saving them on to a SD card. It is working saving down to the internal memory project directory. A few questions to help me out:

  • Are there major changes in what was done in the Git repository above and using OpenXR? My sense is this is mainly an Android issue rather than a Wave vs OpenXR issue. Is that correct?
  • For the files that are saved to internal memory, is there a way to download those? When I go through Windows, it doesn't let me download those. That might be because they are saved in the project-specific folder.

Any other tips?

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi @Alex_HTC and hi everyone,
I have the same issue. I would like to access local files on HTC Vive Focus 3 as I am working with large video files through a Unity apk. I need to access the project build folder or a local folder on the HTC Vive Focus 3 device. When I was working on Meta Quest 2, I used the following path: /sdcard/Android/data/com.DefaultCompany.projectname/video. Do you have any advice on how to access these folders on HTC Vive Focus 3?

Thanks a lot in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...