Permission problem with TaifunFile extension

I get "open failed: EPERM (Operation not permitted) when trying to move a file from the ASD to a folder in external storage. What am I doing wrong? Thank you

I re-imported TaifunFile and now I get this:

You can no longer copy / move a file from the ASD (or any location) to any location of the external storage after the targetSdkVersion = 30 update (nb187 release):
/storage/emulated/0/...

But you can copy / move it to the shared storage: /Download, /Music, /Documents using the File component. See here:

But why do you want to do this?
Just play the sound / music from the ASD.

Well the app I'm developing is supposed to download music, to an accessible folder. So that the user will see the songs in their media player apps, or copy them to other directories, or even be able to find them in the file manager, because it doesn't search for media inside ASD folders.

Ok, I see, then you have to move them to the shared storage e.g. /Music using the File component. But currently there are still some issues / bugs with the File component.

Maybe there will also be an extension later with which (media) files can be downloaded directly to the shared storage.

That's what I'm trying to do but it just says write_external_storage must be enabled in settings etc.

As I said many times, WRITE permission does no longer exist on Android 10+ devices (after the targetSdkVersion = 30 update).

I added this to the manifest:

	<uses-permission
		android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
	<uses-permission
		android:name="android.permission.WRITE_EXTERNAL_STORAGE"
		android:maxSdkVersion="29"/>
	<uses-permission
		android:name="android.permission.READ_EXTERNAL_STORAGE"/>

But still no luck writing to the external with taifunfile extension. should i try the file component (shared scope)? Or just give up hope for external writing for now?

Also, when I ask for permission MANAGE_EXTERNAL_STORAGE in Screen1, it says that it has to be enabled in settings etc, just like it does with WRITE_EXTERNAL_STORAGE.

Hi anonwins

These are changes by Google to firm-up security (affects all programming platforms). You can now only store and access files in the Android shared folders, the App ASD folder and the App Assets folder. Unfortunately, App Inventor is not working correctly with the shared folders right now - we are awaiting an enhancement to file handling.

We need a simple tutorial on how to enable & use shared dirs. I'm kinda confused

Is there some thread that has info/progress of this?

That is where we are. MIT are working on the shared folders issue. When they have a working solution or an laternative, we will have it. There is no timeframe for this.

1 Like

TaifunFile works fine for moving to /Music shared folder. :v:
.

I didn't manage to move to /Music with the file component, but TaifunFile worked perfectly.

And also it creates subfolders, which is great. Thanks everyone

No, I don't think so, neither with Companion nor with the APK on devices with Android ā‰„ 10 (API ā‰„ 29).
Post a simple test aia.

In order for TaifunFile to work, the paths must start with file://
Because that's part of the file API, which is supported in API30+ but only for ASD and shared folders.
Try moving from ASD to file:///storage/emulated/0/Pictures for example. Or /Downloads, /Documents etc

copytest.aia (33.9 KB)

It's interesting how TaifunFile works perfectly right now. There's no need to edit manifest file or ask for permissions or anything. It just works. It can read and write because there's no need for permissions for ASD/shared folders.

Ok, with your test aia the text file is created / saved by the app itself and copied in the ASD. This works with Companion & APK. But if you / the user removes this file the app will no longer work (even not after uninstalling and reinstalling the app).

We should talk here about files that were created by other apps, and this will not work with the TaifunFile extension on devices with API > 28. The Storage Access Framework (SAF) must be used for this, which does not seem to be implemented in AI2 yet.

1 Like

this not really is a solution, because usually apps, which use that permission are rejected by Google, see here, there are a few exceptions...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Indeed this was not a solution. It seems that adding MANAGE_EXTERNAL_STORAGE has virtually no effect on the app. TaifunFile though, works okay without any need for adding/asking for permisssions. But if someone wants to read from the external storage (but not from a shared folder) then I guess READ_EXTERNAL_STORAGE must be asked for in the screen blocks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.