Skip to content Skip to sidebar Skip to footer

How To Get File Data From Android Expansion File In Native Code

I am developing an Android game using the Android NDK. As for all apps weighing over 50mb, an expansion file is necessary. I have implemented the downloading of the expansion file

Solution 1:

Check out <android/storage_manager.h> - there are functions for mounting, unmounting, and getting the path of your obb file:

/**
 * Attempts to mount an OBB file. This is an asynchronous operation.
 */voidAStorageManager_mountObb(AStorageManager* mgr, constchar* filename, constchar* key,
    AStorageManager_obbCallbackFunc cb, void* data);

/**
 * Attempts to unmount an OBB file. This is an asynchronous operation.
 */voidAStorageManager_unmountObb(AStorageManager* mgr, constchar* filename, constint force,
    AStorageManager_obbCallbackFunc cb, void* data);

/**
 * Check whether an OBB is mounted.
 */intAStorageManager_isObbMounted(AStorageManager* mgr, constchar* filename);

/**
 * Get the mounted path for an OBB.
 */constchar* AStorageManager_getMountedObbPath(AStorageManager* mgr, constchar* filename);

Then you should be able to manipulate files as you normally would.

Post a Comment for "How To Get File Data From Android Expansion File In Native Code"