{ "id": "175706", "key": "TIMOB-28231", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-11-16T21:39:39.000+0000", "created": "2020-11-06T04:33:16.000+0000", "epic": { "id": 175371, "key": "TIMOB-28045", "name": "Android 11: Implement Support", "summary": "Android 11: Implement Support", "color": { "key": "color_3" }, "done": false }, "priority": { "name": "High", "id": "2" }, "labels": [ "android", "externalstorage", "filesystem" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-16T21:39:39.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": "*Summary:*\r\nThe Android [externalStorageDirectory|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem-property-externalStorageDirectory] is currently set to a location outside of \"scoped storage\". As of Android 10, you cannot write to this location unless you set \"AndroidManfiest.xml\" {{}} attribute {{requestLegacyExternalStorage}} to {{true}}.\r\nhttps://developer.android.com/about/versions/11/privacy/storage\r\n\r\n*Solution:*\r\nUse the folder location returned by the Java [Context.getExternalFilesDir()|https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)] method. This is a private sandboxed directory for the app that falls under scoped storage.\r\n\r\n*Note 1:*\r\nWith this change, you do *+NOT+* need the following permissions anymore.\r\n* READ_EXTERNAL_STORAGE\r\n* WRITE_EXTERNAL_STORAGE\r\n\r\n*Note 2:*\r\nWith this change, you do *+NOT+* need to use the following APIs anymore.\r\n* [Ti.Filesystem.hasStoragePermissions()|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem-method-hasStoragePermissions]\r\n* [Ti.Filesystem.requestStoragePermissions()|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem-method-requestStoragePermissions]\r\n\r\n*Note 3:*\r\nThe new folder location supports automatic back-up by the Android OS. This means when you uninstall and re-install the app, the files you've written to external storage will be restored.\r\n\r\n*Work-Around:*\r\nFor apps built with Titanium 8.3.0 - 9.2x, you can read/write to {{externalStorageDirectory}} by doing the following in your \"tiapp.xml\" file.\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n", "attachment": [ { "id": "67638", "filename": "FileExternalTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-09T22:04:46.000+0000", "size": 1447, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: Change Ti.Filesystem.externalStorageDirectory to use scoped storage", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1210, "state": "closed", "name": "2020 Sprint 23", "startDate": "2020-11-09T17:49:00.000Z", "endDate": "2020-11-20T17:49:00.000Z", "completeDate": "2020-11-20T17:46:00.641Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "457475", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12253", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-07T06:27:53.000+0000", "updated": "2020-11-07T06:27:53.000+0000" }, { "id": "457521", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nPR Merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-16T21:39:00.000+0000", "updated": "2020-11-16T21:39:00.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }