Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Castiel412 · Dec 19, 2014 at 04:21 PM · androidpersistentdatapath

Make downloaded files accessible to other apps

I am making an app in Unity for android which plays a whole bunch of videos.

Since the apk would be too big if all videos were added at build time, I download the videos at runtime and store them using: Application.persistentDataPath + "/"+filename+".mp4";

The problem is that I am playing the videos inside unity but some devices do not support this functionality (API too low or GPU doesn't support a specific openGL extension), so in those cases my fallback solution is to use androids native player by calling: Handheld.PlayFullScreenMovie(path)

Unfortunately, the videos are stored without world-readable access and therefore the native player is not able to play the downloaded videos.

So my question is, is there a way to make these file world-readable using the path currently used? If not, is there a reliable location where I can store these files where the native player will have access to them regardless of android device?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SkaredCreations · Dec 19, 2014 at 05:32 PM

If it'd exist a way to access non world-readable content then the device would be really a colander, the security is there for a reason and it's to protect data. So my bet it's not a way, as it should exactly be.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Castiel412 · Dec 19, 2014 at 05:43 PM 0
Share

I am creating a file, therefore I should be allowed to decide wether I want other apps to be able to access it or not...outside unity this is a non-issue since you are able to just write to the "externalfolder" and therefore make the file you just created world-readable. Your answer was totally non helpful...

avatar image Castiel412 · Dec 19, 2014 at 05:50 PM 0
Share

I also asked, if it wasn't possible to change the permission. If there was a reliable location to store a file where it would be world-readable. I guess you just forgot to help and decided to just be a smart-ass ins$$anonymous$$d? Thank you anyway for the time taken to "answer"..

avatar image
0

Answer by Bunny83 · Dec 19, 2014 at 06:48 PM

To answer your first question if you can make content of hidden / secured folders readable for other apps: No. This is a security implemented by the OS and can't be circumvented by an ordinary App. I'm sure there are custom rom build which allow to lower or remove certain security measures, however on a vanilla Android this isn't possible.

The second question about a reliable storage location can't be answered that easy since there are so many different Android versions out there. It also depends on if an external storage is available. The sdcard is usually the best bet.

Most systems have an mount point called "/sdcard/" which usually maps to "/storage/emulated/0/". On the sdcard you usually can find a subfolder "Movies". Unity also seems to create a folder for your app at "/sdcard/Android/data/your.application.bundle.id/files/", though it doesn't look like Unity has a way of telling you that path. So just try and see if it's there. It's probably the best if you try multiple locations and if everything fails, prompt the user to manually input a folder.

ps: Unity's folders return this for me:

  • persistentDataPath: "/data/data/your.application.bundle.id/files"

  • dataPath: "/data/app/your.application.bundle.id.apk"

  • temporaryCachePath: "/data/data/your.application.bundle.id/cache"

Since the /data folder isn't accessible for apps you can't do anything here. Only your application has access to your subfolder. The easiest way to construct the sdcard folder would be to take the persistentDataPath and replace "/data/data/" with /sdcard/Android/data/

pps: Keep in mind to have access to the sdcard, make sure you set the "Write Access" to "external" in the player settings / others.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

On Android: move a folder to the PersistentDataPath 1 Answer

No Gamefolder created for mobile game (Nexus 4) 0 Answers

Problem with persistentDataPath on Android 1 Answer

[Android - Data save issues] Does the 'install location' determine the location of persistentDataPath? 1 Answer

[Unity5.6 && Android] Application.persistentDataPath return always "external" storage regardless "write access" settings? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges