Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 RageEye · Aug 07, 2020 at 06:20 PM · androidpathstorage

How to get Internal storage in any Android device

hello i saw a lot of topics about this but none helped me. I need to get the path "storage/emulated/0/" called "internal memory" which is the main path of internal memory in android. I mean the default for each device. if it is possible? I mean the c # code. because I would like to create a folder eg "myApplication" there and create files there

Comment
Add comment · Show 4
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 chandan523 · Jan 03, 2021 at 01:09 PM 0
Share

@Rageeye have you solved the problem?? I am also looking for the solution

avatar image RageEye chandan523 · Jan 03, 2021 at 01:35 PM 0
Share

No, but I know you have to get or write a plugin to unity that interacts with android and its something called PER$$anonymous$$ISSION

avatar image RageEye chandan523 · Jan 03, 2021 at 01:39 PM 0
Share

Permissions: https://developer.android.com/reference/android/$$anonymous$$anifest.permission

(full list) https://gist.github.com/Arinerron/1bcaadc7b1cbeae77de0263f4e15156f

How to: https://stackoverflow.com/questions/5819847/how-to-add-write-to-file-permission-on-android

How to get root path: https://stackoverflow.com/questions/12027830/get-android-device-emulator-root-directory#12027918

[Android] How to get the each directory path https://gist.github.com/granoeste/5574148

avatar image RageEye chandan523 · Jan 03, 2021 at 01:45 PM 0
Share

It can help: https://answers.unity.com/questions/946029/get-sdcard-root-path.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by xxmariofer · Jan 04, 2021 at 10:36 AM

I think you are a little bit confused, since all the statements posted bellow are incorrect, you dont need to write a plugin to "interact" with permisions. you can add the manifest (is a simple xml file) manually. some of the permisions like the one you are asking for like internal storage are located in the player settings menu so there is no need to use a custom manifest, third storage/emulated/0 is already the path, you dont need to find anything else, all phones path is storage/emulated/0 and last, dont create folders arround all directories of the user device, is a really bad practice. if you want to create a folder "myApplication" simply use the persistentdatapath in unity that is located in "/storage/emulated/0/Android/data//files"

Comment
Add comment · Show 7 · 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 RageEye · Jan 04, 2021 at 11:00 AM 0
Share

Ok, but we want to get root path by the command line like "getExternalStorageDirectory()" , not the string "storage/emulated/0", becouse the main path may make a difference on some mobile devices.

avatar image xxmariofer RageEye · Jan 04, 2021 at 11:21 AM 0
Share

The tittle of the question is "get Internal storage" and has nothing to do with the getExternalStorateDirectory. But here is an answered question in that topic

https://stackoverflow.com/a/39994912

avatar image vanlam1188 · Apr 20, 2021 at 06:53 AM 0
Share

Hello @xxmariofer, I have the same problem. When I ran my code on the virtual phone which was created in Genymotion, I could get the path (/storage/emulated/0/...) and open the files in this path correctly. But when I ran my code on the 'real phone', I could get the correct path but I couldn't open the files. I am using android phone 11. Do you have any suggestion? Thanks in advance.

avatar image xxmariofer vanlam1188 · Apr 20, 2021 at 07:28 AM 0
Share

how are you opening the files? what exactly happens? it returns an error? could you share the code?

avatar image vanlam1188 xxmariofer · Apr 20, 2021 at 03:12 PM 0
Share

I opened text files on a virtual phone (android 6) but I cannot open them on a real phone (android 11). This is my code:

path = Application.persistentDataPath; string[] folder = path.Split(char.Parse("0")); path = folder[0] + "0/WaterNet"; ghichu.text = path; if (Directory.Exists(path)) { Xulynet_dropdown.captionText.text = "Folder Exit"; } else { Directory.CreateDirectory(path); Xulynet_dropdown.captionText.text = "Create folder"; }

In this code, I check folder named 'WaterNet' is in the android storage or not. If it doesn't exist, I create a new folder named 'WaterNet'. When I added this code 'Directory.CreateDirectory(path)', it didn't work. Do you know how another way to create a new folder more correctly?

Show more comments

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

288 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android App stopped asking permission for internal storage 0 Answers

How am I able to get the root path of an SDcard for any one android device? 0 Answers

GetDirectories() does not work on Android 1 Answer

Is it possible to access a file from the android Internal storage on to a Unity app during run time? 0 Answers

Android - Access Video from StreamingAssets 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