Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 alanmthomas · Oct 05, 2016 at 06:45 AM · android buildnative plugin

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?

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 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

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
avatar image
0

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.

Comment
Add comment · Show 1 · 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 aditya · Oct 06, 2016 at 09:05 AM 0
Share

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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

unity 5.6.3 play-service aar moving file error 2 Answers

Another Failed to re-package resources build error for Android 2 Answers

Low-level native plugins not working in 4.3 on Windows 3 Answers

DllNotFound when unmanaged c++ plugin library links to another unmanaged c++ library 1 Answer

Using DirectX 11 matrices in a native plugin 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