[TIMOB-17328] Android: Add support for file property to HTTPClient
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-08-18T21:18:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.0 |
Components | Android |
Labels | module_network, qe-automation, qe-testadded |
Reporter | Ingo Muschenetz |
Assignee | Ping Wang |
Created | 2014-07-15T04:18:24.000+0000 |
Updated | 2018-11-13T13:02:30.000+0000 |
Description
In Titanium, we use temporary files when we are dealing with data that can not be kept in memory to avoid OOM errors. One case is in networking calls when the response length is above a threshold. The default is 500K.
The blob representing the response (
responseData
in Ti.Network.HTTPClient) will clearly indicate if the blob represents a file (Titanium.Blob.file will return a valid Titanium.Filesystem.File object). Users are free to delete the file once they have processed the data.
We should allow the users to pass in a file themselves.
PR: https://github.com/appcelerator/titanium_mobile/pull/5927
For FR: 1. Run the above test case. 2. Click each button. Should see an alert with "responseData.nativePath=..." and an image in the imageview. *Note:* when clicking the first button ("file" is not set and the responseData is less than 500k), the responseData is kept in memory so the alert shows "responseData.nativePath = null". 3. Should see the response files in tempDirectory and externalStorageDirectory. *Note:* if the output file is in applicationDataDirectory, we are unable to see it using any File Manager app.
3_3_X PR: https://github.com/appcelerator/titanium_mobile/pull/5936
Verified by using the test case by [~pwang] & it is working as expected. Closing. Environment: Appc Studio : 3.4.0.201408051600 Ti SDK : 3.4.0.v20140815142514 Mac OSX : 10.8.5 Alloy : 1.4.1 CLI - 3.3.0 Code Processor: 1.1.1 Nexus 5 - android 4.4.4
You should make this work also with Titanium.Filesystem.File, like it does in iOS.