Jump to content
  • entries
    943
  • comments
    5,899
  • views
    923,768

Android File System


Josh

2,155 views

 Share

Today I am working out the file system for Android applications. In the past we just manually copied all our assets to a "/Leadwerks" folder on the device itself. This approach is okay for testing, but it won't work for distributing apps in the Google Play store.

 

Android uses APK files to store all applications in. An APK file is really just a ZIP file, and all your assets go in a /res/raw directory in the ZIP package.

 

To access the Android file system from C++, we had to take the following steps:

 

1. Retrieve the file path to the application APK file (with Java).

2. Pass this file path to C++.

3. In C++, load the APK file as a standard zip package.

4. Change the current directory to the APK folder path + "/res/raw".

 

All this occurs before the App::Start() function is called, so as soon as you start, you're ready to access all the files your game needs.

 

It's nice when things work out neatly like that.

 Share

1 Comment


Recommended Comments

glad you know that. something similar to OSX and iOS how the .app is actually an organized folder with a os recognized extension with everything in a particular place.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...