Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23429] Android N: File Permissions

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-05-19T20:41:03.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid-7, androidN
ReporterHieu Pham
AssigneeLokesh Choudhary
Created2016-05-24T17:50:57.000+0000
Updated2017-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

Comments

  1. Ashraf Abu 2016-06-23

    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.
  2. Rodolfo Perottoni 2016-12-19

    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:
       android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/au.com.ethosorthodontics.smileseeker/files/Pictures/Smile%20Seeker/tia75788
       5560.jpg exposed beyond app through ClipData.Item.getUri()
       
    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.
  3. Carlos Henrique Zinato 2016-12-19

    +1 - Android is always too far. Is still missing basic Material Design implementations =/
  4. Frankie Merzadyan 2017-05-09

    master: https://github.com/appcelerator/titanium_mobile/pull/8706 6_1_0: https://github.com/appcelerator/titanium_mobile/pull/9041
  5. Lokesh Choudhary 2017-05-19

    Backport & master PR merged.
  6. Lokesh Choudhary 2017-05-19

    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
  7. Nikos Poulios 2017-09-27

    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?
  8. Guillermo Figueras 2017-09-27

    Nikos Poulis, if you want to open a pdf in Android you have to do this:
       var appFile = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, "yourfile.pdf");
       var appfilepath = appFile.nativePath;
       Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({
       	action : Ti.Android.ACTION_VIEW,
       	type : 'application/pdf',
       	data : appfilepath
       }));
       
  9. Nikos Poulios 2017-09-27

    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
  10. Nikos Poulios 2017-09-27

    https://stackoverflow.com/questions/45190786/titanium-appcelerator-fileuriexposedexception-how-to-use-content-provider fixes the issue for API 24 but not 25
  11. Nikos Poulios 2017-09-27

    See https://medium.com/@ali.muzaffar/what-is-android-os-fileuriexposedexception-and-what-you-can-do-about-it-70b9eb17c6d0
  12. Peter Horner 2017-09-28

    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!!
  13. Raef Akehurst 2017-10-05

    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.

JSON Source