Thanks to @Star-Dust, I have been able to see contain of apk file and moreover to extract files ! I improved a little his code in order to :
- Get the possible error of zip/unzip instructions into BA log,
- Add the ability to extract a selection of files without creating subfolders,
- Suppress the WRITE_EXTERNAL_STORAGE permission which is not usefull for non image files.
Getting the error in BA log:
...
} catch(Exception e) {
ba.Log(e.toString());
ba.raiseEvent(null, "zip_error");
}
...
Add selection in unzip method:
public void unZipDecompress(String zipFile, String outputFolder, String fileSel) {
...
String fileEntry = ze.getName();
String fileName = fileEntry;
// Don't create sub folder(s) when file(s) selection
if (fileSel!="" && fileName.contains("/")) fileName = fileName.substring(fileName.lastIndexOf("/")+1);
File newFile = new File(outputFolder + File.separator + fileName);
new File(newFile.getParent()).mkdirs();
if (!fileEntry.endsWith("/") && fileEntry.contains(fileSel)) {
...