Skip to content Skip to sidebar Skip to footer

How To Unpack Some Files From .apk To /data/data/ Folder While Installing The .apk?

My android application needs another NATIVE application executable to run before the android one, so that they can communicate through sockets. Android application has a JNI layer

Solution 1:

How do i do this?

You don't. You unpack it yourself on first run of your application.

One way I could find is to use AssetManager and then with help of InputStream and OutputStream, i can write this file onto the device the first time it is run and then use it.

Correct.

But there is no point to write it manually on phone memory as it might eat up the memory.

Then why did you want it automatically unpacked there in the first place?

It would be great if there is an option to unzip the necessary files automatically at the time of installation.

No, sorry, this is not possible.

Solution 2:

We have the same issue ... the direction we are exploring is to have two separate installs - the first one is the app and the second one is the data-app. When the data-app installs it copies the binary files to the SD card. When we uninstall the data-app it frees up the internal storage.

We don't have this one completely licked yet, and would love to hear other input and maybe find someone to help us by writing a couple of skeletal sample applications for us.

There are so many people who are in this boat (based on my googling) that if this approach doesn't work I suggest we (or someone) set up a generic file delivery web server and generic file delivery Android service and make it available to developers for a very low cost.

Solution 3:

This isn't a typical use of OBBs but why not use one? It would then be a file separate to your apk installed in a pre-determined location. It doesn't have to be compressed.

Post a Comment for "How To Unpack Some Files From .apk To /data/data/ Folder While Installing The .apk?"