[TIMOB-20439] Android: Using camera bloats app storage
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-11-14T21:38:50.000+0000 |
Affected Version/s | Release 5.2.0, Release 5.1.2 |
Fix Version/s | Release 7.0.0 |
Components | Android |
Labels | android |
Reporter | Sharif AbuDarda |
Assignee | Gary Mathews |
Created | 2016-02-22T15:12:09.000+0000 |
Updated | 2017-11-15T05:42:37.000+0000 |
Description
During our testing we have realized that continuously taking camera images bloats app size. There is currently no way for us to check what is being stored.
1) Problem Description - taking a bunch of pictures (without saving them) bloats up app internal storage size.
2) Exact steps to reproduce:
Download the app [here](https://c.na10.content.force.com/servlet/servlet.FileDownload?file=00PF000000WBSKA).
- install supplied test app
- in application manager: note the size of the app and storage space used
- load supplied app
- press "Open Camera Pictures"
- press "Take"
- press "Retake"
- repeat 10 times
- kill the app
- go back to application manager and note size difference
3) Expected Behavior - no data to be saved. (Image saving is turned off by default according to docs)
4) Number of users affected - all Android users
Salesforce ticket 1[00008173](https://na10.salesforce.com/500F000000oUfKq). Salesforce ticket 2[00008174](https://na10.salesforce.com/500F000000oUfts).
Hello, If saveToPhotoGallery is set to false, taking image will increase the app size. *Steps to Reproduce* saveToPhotoGallery property must be set to false
Actual Result Every photo taken by camera (no matter if later saved or not) will take some space (data on device). There is no way to release that space or get that file, so it will continuously increase taken space until no space is left. If you save the image after taking it, than the space taken is doubled (you create additional file). Of course you can delete saved image but it will only release half of taken space. There is no problem if saveToPhotoGallery is set to true Expected Result Space taken by the image should be released or there should be the way to get the files taking that space.
On Android, if saveToPhotoGallery is false, we store the image in internal storage and return it via success callback. If you wish to NOT use the image that is returned, you can delete it by doing something like this:
This is likely the same for iOS.
I am able to reproduce this issue with the given project and given steps. Initially the application manager showed that the app used 23.7 MB internal storage but after following the given steps it becomes 39.4 MB. But if I change the "openCamera()" function in the project as follows: [Gist Link](https://gist.github.com/N-Salahin/05c9819b41005bb73cd1) then the issue is solved. The app size remains 23.7 MB even after following the steps now. *Environment*: *Device info:* Nexux7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.2.0 and 5.1.2.GA *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5
If I don't use *deleteFile* when is the file flushed from internal storage?
Hello, It depends on the internal storage, The operation will just increase the app size. And you can clean the data manually from the app. I think the best resolution for an user is to put the delete function in the app and automatically delete a file when not saved. Cause the user might not always clean the cache. So, from a developer perspective using the automatically delete option should be best practice. Regards, Sharif
I disagree. This IS a bug. In my opinion it should be fixed instead of using workarounds. This functionality should be an option of Ti.Media.ShowCamera in CameraOptionsType. Otherwise, you rely on developers using workaround that is not documented anywhere.
How is this being marked as resolved? Nothing has been done to resolve this issue....
master: https://github.com/appcelerator/titanium_mobile/pull/9362
FR Passed. Waiting for merge to get enabled.
PR Merged.
Changes are seen in SDK 7.0.0.v20171114202841.