[TIMOB-23429] Android N: File Permissions
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-05-19T20:41:03.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Release 6.1.0 |
Components | Android |
Labels | android-7, androidN |
Reporter | Hieu Pham |
Assignee | Lokesh Choudhary |
Created | 2016-05-24T17:50:57.000+0000 |
Updated | 2017-10-05T04:47:44.000+0000 |
Description
Android N introduces more restrictions to file system permissions. Some of these are breaking changes. We need to test it on our current implementation and modify if needed. Please refer to this for more info: https://developer.android.com/preview/behavior-changes.html
The concern here would be "Passing file:// URIs outside the package domain may leave the receiver with an unaccessible path. Therefore, attempts to pass a file:// URI trigger a FileUriExposedException."" And to solve it is "The recommended way to share the content of a private file is using the FileProvider." This would only affect apps that are passing a reference to a file to another app. If it's within the app, there would be no issues.
This is once again a huge reason to be ashamed of yourselves. Android 7 has been in the market since 6+ months. Yet, you still release new iOS versions features within 1 week of its launch. What's the problem with you guys? I'm getting this exception when trying to call the *Ti.Media.showCamera* on a Android phone with the API 24 installed:
From everything I've read on the internet this issue happens because of what @Ashraf Abu said above. Are you guys planning to support Android as much as you support iOS some day in the future ? This is just sad.
+1 - Android is always too far. Is still missing basic Material Design implementations =/
master: https://github.com/appcelerator/titanium_mobile/pull/8706 6_1_0: https://github.com/appcelerator/titanium_mobile/pull/9041
Backport & master PR merged.
Verified the implementation for the new permissions model for android N & did not find any issues. Closing. Studio Ver: 4.9.0.201705170123 SDK Ver: 6.1.0.v20170519131839 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.2 Appc NPM: 4.2.9 Appc CLI: 6.2.1 Ti CLI Ver: 5.0.13 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 6 --- Android 6.0.1 ⇨ google Pixel XL --- Android 7.1.1
Issue is fixed form showCamera but not when you want to create an intent to open another file e.g. a pdf. I think a ContentProvider is required for that. Is there any guide for that on Titanium?
Nikos Poulis, if you want to open a pdf in Android you have to do this:
This does not work anymore if you target android 24 and above, throwing the file:// URI trigger a FileUriExposedException no matter what Ti SDK you use
https://stackoverflow.com/questions/45190786/titanium-appcelerator-fileuriexposedexception-how-to-use-content-provider fixes the issue for API 24 but not 25
See https://medium.com/@ali.muzaffar/what-is-android-os-fileuriexposedexception-and-what-you-can-do-about-it-70b9eb17c6d0
I am having the same problem as Nikos Poulios. Ti SDK 6.2.2 targeting Android 25. Getting the FileUriExposedException when trying to create an intent to open a PDF in another app like Adobe Acrobat Reader. This is a critical bug and needs to be fixed ASAP. Thanks!!
I am also facing the same issue. Ti SDK 6.2.2 targeting Android 25. Anyone come up with a solution or workaround? Note. I am experiencing some weird results when testing this. On Android 7 I can't open a PDF (I get the FileUriExposedException error) but I can attach a file to an email. On Android 8 I can open a PDF bit I can't attach a file to an email (I get the FileUriExposedException error). I will post more if I find out a solution.