5

I have two files (for example) that I want to put in my apk main expansion file. Let these files be img1.jpg and img2.jpg. I compress them using the following command:

zip -n .jpg main.123.in.example.app.obb *.jpg

(The version code is 123 and the package is in.example.app). This creates an obb file: main.123.in.example.app.obb

I place this code on an appropriate path. I can access the files img1.jpg and img2.jpg easily by calling the following:

File root = Environment.getExternalStorageDirectory();
File expPath = new File(root.toString() + "/Android/obb/in.example.app");
String pathToObb = expPath + File.separator + "main.123.in.example.app.obb";
ZipResourceFile zip = new ZipResourceFile(pathToObb);
InputStream iStream = zip.getInputStream("img1.jpg");
Bitmap bmp = BitmapFactory.decodeStream(iStream, null, options);// options to decode

This works perfectly. Now, how does one read an encrypted zip file created using the following:

zip -n -encrypt .jpg main.123.in.example.app.obb *.jpg

Is there any way we can read such an encrypted zip file? Or do we resort to the jobb tool to do the encryption and use StorageManager to mount encrypted obb and read from there?

chochim
  • 1,710
  • 5
  • 17
  • 30

0 Answers0