Highlighted

Android 6.0 Sharing files

Contributor ,
Oct 21, 2015

Copy link to clipboard

Copied

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?

TOPICS
Development

Views

872

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Android 6.0 Sharing files

Contributor ,
Oct 21, 2015

Copy link to clipboard

Copied

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?

TOPICS
Development

Views

873

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 21, 2015 0
Adobe Employee ,
Oct 23, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2015 0
Contributor ,
Oct 29, 2015

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2015 0
Contributor ,
Mar 22, 2016

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 22, 2016 0