- Home /
Trying to find the path to file inside an Android .apk
Hello. I'm working with someone that is creating a native plugin for Android devices. We're running into an issue in that he needs to know a path to some files included inside the .apk file.
If I unpack the .apk that Unity builds, I can see the files included in a folder called "assets" off of the root. Its worth mentioning that the two files he needs for his code function are not of a type that is recognized by Unity, so I had to do a little bit of massaging to get them to be included in the build.
My question is, once the .apk is installed on the device, how can I go about getting the path to those files to pass to his code? I tried using Application.dataPath with no luck.
Any suggestions?
Answer by aditya · Oct 06, 2016 at 06:41 AM
This might help you out : Resources.Load
Keep in mind that you need to create a folder named "Resources" in your "Assets" folder and place your files in this new folder
Answer by alanmthomas · Oct 06, 2016 at 07:54 AM
Thanks for the tip, @aditya. I've actually already worked out how to get the files included in the build. That is not the issue. The issue is getting the path to those files on the actual device and then passing that to the native plugin. The passing part is easy. It is the determining the path part that is difficult.
I'm trying the approach of first copying these files into the device's persistent data. I can see them there. The difficulty I am finding now is accurately determining that path or if this is even the correct approach to handle something like this.
Sorry brother now i have a bad news for you ... after you've build your project for android, every file of that project is serialized and stored, this means that there is no such thing as "PATH" exists then ... now the only option that you have is store your files on device and fetch their path ... BTW why are you facing a problem with persistentDataPath ?
Your answer
