{ "id": "154920", "key": "TIMOB-20440", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" }, { "id": "17707", "name": "Release 5.3.0", "archived": false, "released": true, "releaseDate": "2016-06-04" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-21T08:07:24.000+0000", "created": "2016-02-15T10:44:46.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-12T06:09:00.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Before targeting API 23 on Android this function worked fine for storing remote images in the applicationDataDirectory:\r\n\r\n{code}\r\nfunction onImageLoad(e){\r\n var imageDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'images/cache');\r\n if (! imageDir.exists()) {\r\n imageDir.createDirectory();\r\n }\r\n \r\n var image = _.last(e.source.image.split('/'));\r\n\r\n var localFile = Ti.Filesystem.getFile(imageDir.resolve(), image);\r\n localFile.write(e.source.toBlob());\r\n \r\n e.source.removeEventListener('load', onImageLoad);\r\n}\r\n{code}\r\n\r\nWith Titanium 5.2.0 targeting Android API >= 23 : {{file.write}} does not work throwing this error:\r\n\r\n{code}\r\n[ERROR] TiFileProxy: (KrollRuntimeThread) [407,3676] External storage permissions missing\r\n{code}\r\n\r\nWriting to the __applicationDataDirectory__ should not require this permission.\r\n\r\n*Expected*\r\n{{file.write()}} should work.\r\n\r\n*Result*\r\n{{file.write()}} fails with\r\n{{ERROR: External storage permissions missing}}\r\n", "attachment": [ { "id": "58246", "filename": "Screen Shot 2016-02-16 at 2.47.35 PM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-16T08:48:07.000+0000", "size": 53326, "mimeType": "image/png" }, { "id": "58256", "filename": "Screen Shot 2016-02-17 at 11.38.49 AM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-17T05:42:49.000+0000", "size": 67982, "mimeType": "image/png" } ], "flagged": false, "summary": "Android 6.0: writing to applicationDataDirectory fails without External storage permissions", "creator": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "environment": "5.2.0.v20160214213247", "closedSprints": [ { "id": 597, "state": "closed", "name": "2016 Sprint 06 SDK", "startDate": "2016-03-12T01:30:59.982Z", "endDate": "2016-03-26T00:30:00.000Z", "completeDate": "2016-03-28T03:38:09.726Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "376951", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I tried to reproduce the issue of writing files in Android. Below is a sample code i am using. I have tested with SDK 5.2.0.v20160114021251 and in Nexus 5 Android 6.0.0. Writing to files is working as expected. See the screenshot. \r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\r\n backgroundColor : '#ffffff'\r\n\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n top : 10,\r\n\r\n width : 200,\r\n\r\n height : 50,\r\n\r\n title : \"write file\"\r\n\r\n});\r\n\r\nwin.add(button);\r\n\r\nbutton.addEventListener('click', function(e) {\r\n\r\n var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'fileter.txt');\r\n\r\n f.write('writing to the file would be enough to create it');\r\n\r\n alert(f.read());\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-16T08:48:32.000+0000", "updated": "2016-02-16T08:48:32.000+0000" }, { "id": "376952", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thank you for testing. I've just created a new clean project and tested your code on both of my devices, a Nexus 5 and Nexus 5X (both with Android 6.0.1). But I get different results. On the Nexus 5 it works as expected like shown in your screenshot. On the Nexus 5X The Alert body is empty and the console prints this error:\r\n{code}\r\n[ERROR] TiFileProxy: (KrollRuntimeThread) [7799,7799] External storage permissions missing\r\n[ERROR] TiBlob: (KrollRuntimeThread) [14,7813] /data/user/0/com.goyya.test.alloy/app_appdata/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: java.io.FileNotFoundException: /data/user/0/com.goyya.test.alloy/app_appdata/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] TiBlob: \tat java.io.FileInputStream.(FileInputStream.java:76)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:209)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.io.TiFile.read(TiFile.java:351)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiFileProxy.read(TiFileProxy.java:239)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)\r\n[ERROR] TiBlob: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] TiBlob: \tat android.os.Looper.loop(Looper.java:148)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] TiBlob: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] TiBlob: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] TiBlob: \t... 17 more\r\n[ERROR] TiBlob: (KrollRuntimeThread) [19,7832] /data/user/0/com.goyya.test.alloy/app_appdata/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: java.io.FileNotFoundException: /data/user/0/com.goyya.test.alloy/app_appdata/fileter.txt: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] TiBlob: \tat java.io.FileInputStream.(FileInputStream.java:76)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.io.TiFile.getInputStream(TiFile.java:264)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:389)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.getBytes(TiBlob.java:324)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.getText(TiBlob.java:452)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.TiBlob.toString(TiBlob.java:511)\r\n[ERROR] TiBlob: \tat ti.modules.titanium.TitaniumModule.alert(TitaniumModule.java:232)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)\r\n[ERROR] TiBlob: \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)\r\n[ERROR] TiBlob: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] TiBlob: \tat android.os.Looper.loop(Looper.java:148)\r\n[ERROR] TiBlob: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] TiBlob: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)\r\n[ERROR] TiBlob: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] TiBlob: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] TiBlob: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] TiBlob: \t... 15 more\r\n{code}\r\n\r\nCould it be this is an arm64 issue?", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-16T09:05:03.000+0000", "updated": "2016-02-16T09:08:16.000+0000" }, { "id": "377066", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I tested again in Nexus 5X Android 6.0.0. The issue is not reproducible. Writing to files is working as expected. See the screenshot. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-17T05:43:39.000+0000", "updated": "2016-02-17T05:43:39.000+0000" }, { "id": "377110", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "It's because you've granted the Storage permission. Can you please disable this permission in the Settings and try again?\r\n\r\nThis is the problem I'm trying to point out. The File Proxy should distinguish between internal and external storage. Writing into *applicationDataDirectory* does not require READ_EXTERNAL_STORAGE permission but it checks for it and fails though.", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-17T14:50:18.000+0000", "updated": "2016-02-17T14:50:18.000+0000" }, { "id": "377224", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "Not sure if this may be related to this issue but sometimes my app crashes with this exception:\r\n{code}\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): FATAL EXCEPTION: AsyncTask #1\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): Process: com.goyya.fde, PID: 29091\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat org.appcelerator.titanium.util.TiFileHelper2.hasStoragePermission(TiFileHelper2.java:89)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:314)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.CacheAdapter.getJavaCachedResponse(CacheAdapter.java:103)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.CacheAdapter.get(CacheAdapter.java:47)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:229)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:501)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:253)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeConnectionAndWait(GraphRequest.java:1255)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1157)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1124)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1108)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeAndWait(GraphRequest.java:1083)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.GraphRequest.executeAndWait(GraphRequest.java:977)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.internal.Utility.getAppSettingsQueryResponse(Utility.java:868)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.internal.Utility.access$1(Utility.java:860)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat com.facebook.internal.Utility$1.run(Utility.java:797)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat java.lang.Thread.run(Thread.java:818)\r\n{code}", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-18T13:27:11.000+0000", "updated": "2016-02-18T13:27:11.000+0000" }, { "id": "377473", "author": { "name": "wilsonliaw", "key": "wilsonliaw", "displayName": "Wilson Liaw", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Yes, I can confirm this External storage permissions problem on nexus 9, it works on SDK <= 5.1.2, but not 5.2.0", "updateAuthor": { "name": "wilsonliaw", "key": "wilsonliaw", "displayName": "Wilson Liaw", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2016-02-22T01:55:06.000+0000", "updated": "2016-02-22T01:55:06.000+0000" }, { "id": "378173", "author": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "body": "Not trying to be rude or pushy, can we expect the fix for this in 5.3.0. or along with the Google Play Store X509 security fix? :) We do not want to add the external storage permission as a fix as it would give wrong impression to the user. ", "updateAuthor": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "created": "2016-02-29T18:40:12.000+0000", "updated": "2016-02-29T18:40:12.000+0000" }, { "id": "378567", "author": { "name": "fstrazzante", "key": "fstrazzante", "displayName": "Francesco Strazzante", "active": true, "timeZone": "Europe/Rome" }, "body": "Hello, I've the same problem on Moto X Play (XT1562) with Android 6.0 and SDK 5.2.0GA with or without Android External Permission. The same code works on Xiaomi MI-4C with MIUI 6.1.28 (Android 5.1.1) without user permission and SDK 5.2.0GA.\r\n\r\nvar photo = Ti.Network.createHTTPClient();\r\nphoto.open('GET', 'someurl');\r\nphoto.onload = function() {\r\n\tvar dir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'biodiversita');\r\n\tif (!dir.exists()) {\r\n\t dir.createDirectory();\r\n\t}\r\n\tf = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, \"biodiversita/name.jpg\");\r\n\tf.write(this.responseData);\r\n};\r\n\r\nphoto.send();\r\n\r\nI tried to use SDK 5.1.2 without Android External Permission on the same Moto X Play and it works. ", "updateAuthor": { "name": "fstrazzante", "key": "fstrazzante", "displayName": "Francesco Strazzante", "active": true, "timeZone": "Europe/Rome" }, "created": "2016-03-03T10:16:45.000+0000", "updated": "2016-03-03T10:18:11.000+0000" }, { "id": "379935", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/7858", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-16T23:07:33.000+0000", "updated": "2016-03-16T23:07:33.000+0000" }, { "id": "379948", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~manuellehner] Your crash log earlier with regards to\r\n{code}\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): FATAL EXCEPTION: AsyncTask #1\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): Process: com.goyya.fde, PID: 29091\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference\r\n02-18 14:22:34.907: E/AndroidRuntime(29091): \tat org.appcelerator.titanium.util.TiFileHelper2.hasStoragePermission(TiFileHelper2.java:89)\r\n{code} is due to another issue which is solved in TIMOB-20434. The fix is in 5.2.0. Just fyi.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-17T02:57:30.000+0000", "updated": "2016-03-17T02:57:30.000+0000" }, { "id": "380113", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am on a nexus 7 with android 6.0.....I am running SDK 5.2.0 and keep getting these error. [ERROR] : TiFileProxy: (KrollRuntimeThread) [11,30395] External storage permissions missing.\r\n\r\nDo we know when this is fixed?", "updateAuthor": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-18T16:34:19.000+0000", "updated": "2016-03-18T16:34:19.000+0000" }, { "id": "380206", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~peterladis] Is your code similar to what's being mentioned in this ticket?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-21T02:48:27.000+0000", "updated": "2016-03-21T02:48:27.000+0000" }, { "id": "380218", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Master PR https://github.com/appcelerator/titanium_mobile/pull/7858 Merged.\r\nAnd PR https://github.com/appcelerator/titanium_mobile/pull/7871 for fixing tests Merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-21T08:23:03.000+0000", "updated": "2016-03-22T08:40:04.000+0000" }, { "id": "380222", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~msamah] what version(s) are we fixing this in?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-21T08:45:35.000+0000", "updated": "2016-03-21T08:45:35.000+0000" }, { "id": "380227", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~fokkezb] Thanks for pointing that out.\r\nThis is in master, fix version is -6.0.0.- 5.4.0.\r\n(Incorrectly mentioned it to be 6.0.0.)\r\n", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-21T09:03:58.000+0000", "updated": "2016-03-22T08:48:01.000+0000" }, { "id": "380340", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "I got same error with Titanium.Filesystem.tempDirectory and why it not fixed for 5.2.1 ?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-22T08:36:37.000+0000", "updated": "2016-03-22T08:36:37.000+0000" }, { "id": "380341", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~falko] Thanks for bringing this up. 5.2.1 is already scheduled and it's too late to bring this into that. Instead, we'll add this to the next patch (5.3.0).", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-22T08:51:22.000+0000", "updated": "2016-03-22T08:51:22.000+0000" }, { "id": "380342", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "OK. This PR has fix for Titanium.Filesystem.tempDirectory or Titanium.Filesystem.applicationDataDirectory only?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-22T08:55:55.000+0000", "updated": "2016-03-22T08:56:51.000+0000" }, { "id": "380343", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "This fix is for applicationDataDirectory but it also works for the tempDirectory.\r\nSample code:-\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : '#ffffff'\r\n});\r\nvar button = Ti.UI.createButton({\r\n top : 10,\r\n width : 200,\r\n height : 50,\r\n title : \"write file\"\r\n});\r\nwin.add(button);\r\nbutton.addEventListener('click', function(e) {\r\n var f = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'fileter.txt');\r\n f.write('writing to the file would be enough to create it');\r\n alert(f.read());\r\n});\r\n \r\nwin.open();\r\n{code}\r\nPermission is not required.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-22T09:13:59.000+0000", "updated": "2016-03-22T09:13:59.000+0000" }, { "id": "380344", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "5_3_X PR: https://github.com/appcelerator/titanium_mobile/pull/7872 (Merged)", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-22T09:14:08.000+0000", "updated": "2016-03-22T09:20:46.000+0000" }, { "id": "380356", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-22T11:35:29.000+0000", "updated": "2016-03-22T12:53:35.000+0000" }, { "id": "380419", "author": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "body": "The target fix version on 5.3.0. @Ashraf Abu, can you please let us know the date by when we can expect the GA for 5.3.0. One of the new application that we are developing is targeting to save data in application data folder.", "updateAuthor": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "created": "2016-03-22T19:15:48.000+0000", "updated": "2016-03-22T19:15:48.000+0000" }, { "id": "380420", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-22T19:18:09.000+0000", "updated": "2016-03-22T19:18:09.000+0000" }, { "id": "380422", "author": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "body": "@Andrey Tkachenko\r\nThanks for sharing the link. So we can expect the GA around Apr 11 and the RC before that, which is a good news.", "updateAuthor": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "created": "2016-03-22T19:20:31.000+0000", "updated": "2016-03-22T19:20:31.000+0000" }, { "id": "380423", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "@Soumya Kanti Kar You can add PR to 5.2.X branch and compile SDK at any time.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-22T19:23:25.000+0000", "updated": "2016-03-22T19:23:25.000+0000" }, { "id": "380477", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~falko] based on your log it seems you are trying to use `tempDirectory` which TIMOB-20470 is about. In that case, please follow that jira. For the issue of this ticket of `applicationDataDirectory` this is resolved. Thanks!", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-23T07:48:02.000+0000", "updated": "2016-03-23T07:48:13.000+0000" }, { "id": "380480", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "@Ashraf Abu Yes I point it in my comment. But I answered to your comment.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-23T08:10:22.000+0000", "updated": "2016-03-23T08:10:22.000+0000" }, { "id": "381999", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified he fix.\r\n\r\nWriting to applicationDataDirectory doe not fail without storage permissions.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.6.0.201604041329\r\nTi SDK : 5.3.0.v20160404105211, 5.4.0.v20160406101605\r\nTi CLI : 5.0.7\r\nAlloy : 1.8.5\r\nMAC El Capitan : 10.11.4\r\nAppc NPM : 4.2.5-2\r\nAppc CLI : 5.3.0-12\r\nNode: 4.2.2\r\nNexus 6 - Android 6.0.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-04-06T22:46:15.000+0000", "updated": "2016-04-06T22:46:37.000+0000" }, { "id": "382098", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "Since Android6 you need runtime permissions. There is a module (Ti.permissions). All details on github.", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-07T16:56:08.000+0000", "updated": "2016-04-07T16:56:08.000+0000" }, { "id": "382178", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~titanium@webmasterei-hamburg.de] with the fixes for this ticket you shouldn't need to. Could you verify that?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-04-08T09:28:55.000+0000", "updated": "2016-04-08T09:28:55.000+0000" }, { "id": "382180", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "I never seen problems by writing to applicationdata folder. ", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-08T09:42:49.000+0000", "updated": "2016-04-08T09:42:49.000+0000" }, { "id": "382181", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "OK, what exactly does your comment relate to then?\r\n\r\n{quote}\r\nSince Android6 you need runtime permissions. There is a module (Ti.permissions). All details on github.\r\n{quote}", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-04-08T09:43:55.000+0000", "updated": "2016-04-08T09:43:55.000+0000" }, { "id": "382182", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "I thought the ticket was in realtion to the new perfmissions. Was mistake.", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-08T09:45:08.000+0000", "updated": "2016-04-08T09:45:08.000+0000" }, { "id": "387636", "author": { "name": "bhavin2887", "key": "bhavin2887", "displayName": "Bhavin Bhavsar", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\n\r\nI got the latest SDK- 5.3.0.GA\r\nAppcelerator Studio- 4.6.0.201605201934\r\nNode=- V4.4.4\r\n\r\nBut, still the issue is not resolved. Below is the error.\r\n\r\n{code:java}\r\n[ERROR] : TiFileProxy: (KrollRuntimeThread) [6570,10154] IOException encountered\r\n[ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/com.abc.def/others/assets.zip: open failed: EACCES (Permission denied)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiFileProxy: \tat java.io.FileOutputStream.(FileOutputStream.java:87)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.open(TiFile.java:336)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.write(TiFile.java:382)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:285)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155)\r\n[ERROR] : TiFileProxy: \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\n[ERROR] : TiFileProxy: \tat android.os.Looper.loop(Looper.java:158)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)\r\n[ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)\r\n[ERROR] : TiFileProxy: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiFileProxy: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiFileProxy: \t... 11 more\r\n{code}\r\n\r\nAll the permissions are already in tiapp.xml file.\r\n\r\nThanks", "updateAuthor": { "name": "bhavin2887", "key": "bhavin2887", "displayName": "Bhavin Bhavsar", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-06T09:10:33.000+0000", "updated": "2016-06-06T09:10:33.000+0000" }, { "id": "387638", "author": { "name": "pic", "key": "pic", "displayName": "Mauro Piccotti", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've just updated all the stable versions of 2nd June and I have exactly the same problem of Bhavin Bhavsar.", "updateAuthor": { "name": "pic", "key": "pic", "displayName": "Mauro Piccotti", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-06T10:14:16.000+0000", "updated": "2016-06-06T10:14:16.000+0000" }, { "id": "419602", "author": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am getting same issue on \r\nTitanium sdk 6.0.4 , Android Platform 6.0 , Android API 23\r\n\r\n-----------------------------\r\n\r\n{code:java}\r\n[ERROR] : TiFileProxy: (main) [1353,1353] IOException encountered\r\n[ERROR] : TiFileProxy: java.io.FileNotFoundException: /storage/emulated/0/com.infogridpacific.sample/sample.txt: open failed: EACCES (Permission denied)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:452)\r\n[ERROR] : TiFileProxy: \tat java.io.FileOutputStream.(FileOutputStream.java:87)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.getOutputStream(TiFile.java:273)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.open(TiFile.java:336)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.io.TiFile.write(TiFile.java:460)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:287)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:196)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:241)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:128)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:183)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:172)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:682)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:169)\r\n[ERROR] : TiFileProxy: \tat org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:161)\r\n[ERROR] : TiFileProxy: \tat android.app.Activity.performCreate(Activity.java:6237)\r\n[ERROR] : TiFileProxy: \tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)\r\n[ERROR] : TiFileProxy: \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)\r\n[ERROR] : TiFileProxy: \tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\r\n[ERROR] : TiFileProxy: \tat android.app.ActivityThread.-wrap11(ActivityThread.java)\r\n[ERROR] : TiFileProxy: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\r\n[ERROR] : TiFileProxy: \tat android.os.Handler.dispatchMessage(Handler.java:102)\r\n[ERROR] : TiFileProxy: \tat android.os.Looper.loop(Looper.java:148)\r\n[ERROR] : TiFileProxy: \tat android.app.ActivityThread.main(ActivityThread.java:5417)\r\n[ERROR] : TiFileProxy: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] : TiFileProxy: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\r\n[ERROR] : TiFileProxy: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\r\n[ERROR] : TiFileProxy: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)\r\n[ERROR] : TiFileProxy: \tat libcore.io.Posix.open(Native Method)\r\n[ERROR] : TiFileProxy: \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)\r\n[ERROR] : TiFileProxy: \tat libcore.io.IoBridge.open(IoBridge.java:438)\r\n[ERROR] : TiFileProxy: \t... 26 more\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-12T05:57:10.000+0000", "updated": "2017-05-12T05:57:10.000+0000" }, { "id": "419603", "author": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "body": "for the above error : I am writing/reading file from the external storage device.\r\n\r\ntiapp.xml\r\n==============\r\n\r\n{code:java}\r\n \r\n \r\n \r\n \r\n \r\n \r\n{code}\r\n\r\n\r\n\r\n\r\napp.js\r\n=============\r\n\r\n{code:java}\r\nvar cameraPermission = \"android.permission.CAMERA\";\r\nvar storagePermission = \"android.permission.READ_EXTERNAL_STORAGE\";\r\nvar hasCameraPermission = Ti.Android.hasPermission(cameraPermission);\r\nvar hasStoragePermission = Ti.Android.hasPermission(storagePermission);\r\nvar permissionsToRequest = [];\r\n\r\n\r\n\r\nvar win = Ti.UI.createWindow({\r\n title: 'mywin',\r\n backgroundColor: '#fff',\r\n width : Ti.UI.FILL,\r\n height : Ti.UI.FILL\r\n});\r\n\r\nwin.open();\r\n\r\n\r\nif (!hasCameraPermission) {\r\n permissionsToRequest.push(cameraPermission);\r\n}\r\nif (!hasStoragePermission) {\r\n permissionsToRequest.push(storagePermission);\r\n}\r\nif (permissionsToRequest.length > 0) {\r\n Ti.Android.requestPermissions(permissionsToRequest, function(e) {\r\n if (e.success) {\r\n Ti.API.info(\"SUCCESS\");\r\n } else {\r\n Ti.API.info(\"ERROR: \" + e.error);\r\n }\r\n });\r\n}\r\n\r\n\r\n\t\tvar localPath = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory).nativePath;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\tvar sampletxtvar = Ti.Filesystem.getFile(localPath, \"sample.txt\");\r\n\t\tsampletxtvar.write(\"this is my sample text\");\r\n\r\n\t\tvar content = \"\";\t\t\r\n\r\n\t\tif (sampletxtvar.exists()) {\r\n\t\t\t\t\tcontent = nomediatxt.read().text;\r\n\t\t\t\t\talert(\"Content is ::: \" +content);\r\n\t\t}\r\n{code}", "updateAuthor": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-12T06:09:00.000+0000", "updated": "2017-05-12T06:09:00.000+0000" } ], "maxResults": 40, "total": 40, "startAt": 0 } } }