Skip to main content
Inspiring
October 21, 2015
Question

Android 6.0 Sharing files

  • October 21, 2015
  • 1 reply
  • 1270 views

I have noticed that Android 6.0 seems to break my ability to share a file from my app using a bunch of ANE's.  It feels like a permission issue given the changes they made to the permissions in Android 6 but here is what I am doing.

1. Create and save image to documentsDirectory/mydirectory/myfile.  When I trace this, the native path is /storage/emulated/0/mydirectory/myfile

2. Share file using that path (tried several share ANE's but they all fail to attach)

I have verified that File.exists but something happens when I pass it on to the ANE that doesn't happen in earlier versions.  I have both WRITE and READ_EXTERNAL_STORAGE declared in the manifest (even though WRITE is sufficient as per Android docs). 

If I try to navigate to the /storage/emulated/0/mydirectory/myfile within something like ES File Explorer, I can't.  I can only find it via /mnt/sdcard/mydirectory/myfile.  If I hardcode the latter path into the share function, it gives the same error.

I guess my question is whether anyone had a little trick on this or noticed this behavior as well?

This topic has been closed for replies.

1 reply

Adobe Employee
October 23, 2015

Hi,

For Android 6.0(API level 23), the app requests permissions from the user at run-time. Android divided the System permissions in two protection levels(Normal and Dangerous). If your app needs a dangerous permission that was listed in the app manifest, it must ask the user to grant the permission. For this to work, You need to do certain handling in the android code for ANE. For more info: You can also refer to the below link:

http://developer.android.com/intl/ja/training/permissions/requesting.html


Hope it helps!!


Thanks,

Adobe AIR Team

mola2alexAuthor
Inspiring
October 29, 2015

That's actually not what happened, the path is wrong, it requires file:// to be added and passed to the intent.  The Android 6.0 permissions only apply if you target SDK level 23 which I haven't done.

mola2alexAuthor
Inspiring
March 22, 2016

What is your targetSdk in your manifest?  If I put my target SDK to 23, I cannot even save to file anymore. How do you request access for the read/write permission within Android 6 from an AIR app?