I have an obb file which is a zip file, which I unpack after downloading it in the obb folder. Then I copy the unpacked obb files to Internal Storage.
I just released an app to Internal testing. I installed the app, but I was hoping that the obb files would be automatically deleted, but it seems they are still hanging in there, and when I check the Storage size in Settings, the size of the apk file includes the data in the obb folder. I don't want this, because my app is taking less storage then it's actually showing in Settings / Storage.
Is there an Android process that automatic removes the obb files later on, or do I need to delete them myself when I don't need them anymore, right after copying them to internal storage?
The answer is no. The only time the OBB file gets deleted is when the user uninstalls the app. Or when the app deletes the file itself.
On a side note, which I happened to find out only later, if you delete or rename your OBB file, it gets re-downloaded every time you release an app update. So you are better off using the OBB file as is and leave it there as originally installed, and using a second OBB file for updates (your listed app size will include the OBB file though), or another option is using a file hosting service such as Dropbox if you don't want the OBB file just sitting there.
Related
In android 11 I saved photos in Download dir /storage/emulated/0/Download/SavedImages/ when I delete file using File.delete() it's working perfectly.
But issue is when I saved files to Download dir /storage/emulated/0/Download/SavedImages/ after that I uninstall my App and re-install and I try to delete file using File.delete() the file not delete why?
You do not have read/write/delete access to files in Download/, except for those that your app installation put there. Any files downloaded by your app there are usable by that app installation, but if the user uninstalls/reinstalls the app, then those files are inaccessible, just as are files put there by anything else.
I want to copy a file to the internal storage directory reserved for an application (not my application, I only have the apk) built in release mode. I thought of two solutions, but none of them actually work (note that rooting the phone is not an option):
Directly copying the data to the internal storage folder of that app (not possible because the app was built in release mode).
Installing another app in debug mode with the same ID as the original app, copying the file there then installing the original app. However, this does not work because the two apps have different signatures, and if I first uninstall the debug app android wipes its internal storage folder.
Is there any other way to do this? What I need is to somehow have that file end up in that app's internal storage.
I have a large file in my "assets" folder. Now every time when I run my application through eclipse, it copies the large file on the device. It takes too long in uploading file. I want to copy the large file on to the device only when it is changed and not every time. how to do that?
as long as the file is a part of your "assets" folder, it will be apart of your apk and there for you will have to pay the upload time.
you can reduce the apk upload time by removing the large files from your asset folder and getting them from somewhere else.
for example, you can use android expansion files for that purpose.
if you have to use it in assets folder, you can create a special "debug" apk:
special apk will not have the file in its assets, it will load the file from local storage. you can use adb to push the large file to the device. this way you will only load the file once to device and save precious debug time.
I followed this guide for download expansion files. When I checked it, the download worked fine, but when I wanted to uninstall the application from the phone the files stayed there.
How can I cause the files to be deleted with the app?
Downloaded expansion file(s) will be stored in your shared-storage folder (usually this is your sd-card). There is no code that can be triggered when uninstalling your application. This unfortunately means that you cannot remove expansion files from code when uninstalling the application.
However I did find out that on my Nexus 4 but also on a Samsung Galaxy S the expansion file is automatically deleted from the shared-storage folder when uninstalling the application. I tested this using an application that is in the play store.
When the expansion file is not deleted automatically then the only way to get rid of your expansion files after an uninstall would be to manually delete the file(s) from your shared-storage folder. An end-user can be instructed to remove the expansion file manually by letting him/her attach the device to the computer and navigate to:
<shared-storage>/Android/obb
In this folder you should see one or more folders with package names. Pick the folder that will contain your expansion file and delete the package folder or the expansion file depending on what you wish to be deleted. Be aware that deleting the wrong package can affect different apps. So use manual deletion with caution!
Some reasons why an expansion can't be deleted by end-user:
End-user doesn't have drivers for the device so it can't see what's on the shared-storage
End-user uninstalled the application and the expansion file is already gone
Store your app files in the Applications private directory.
This can be obtained with getFilesDir()
When your application is uninstalled, all files in this directory get deleted.
How the .apk installation process works on device? Is the .apk file just copied to some place and kind of installer application extracts the application information, register somehow the application to environment, extract also the icon and put it on the application launch screen? Or the .apk content is extracted and files are copied to various folders and the .apk file itself is deleted?
I am asking to understand if there is any possibility on device to browse the .apk file structure and its content and access in read-only mode directly the assets, res folders, AndroidManifest.xml, the dex file and also used libraries (.jar or .so)?
The reason I am asking is that I am looking for possibility to read into memory .dex, .jar or .so files like arbitrary binary files (e.g. by using the File class) for the purpose of computing a message digest from its content (i.e. using md5 or other hash method)...
BR
STeN
The APK is copied onto the device, usually into the /system/app directory. The APK is not extracted or unzipped until it is used, so if you want to probe the files you'll need to do the decompression and extraction yourself.