Android 11 and Storage-File

Yes, there are a lot of those. I already posted a link.

1 Like

Btw, the Explorer app doesn't declare these permissions in the Manifest and its targetSdkVersion is still 29 (Android 10).
It declares android:requestLegacyExternalStorage="true" in the Manifest, which will be ignored when apps must target API 30 (Aug 2021 for new apps and Nov 2021 for updates).

It declares <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> that is no longer available on Android 11 (targetSdkVersion=30).

1 Like

My phone was upgraded to android 11, my apps that read and write on Documents folder run well, If I understand well they will stop to run in Aug 2021 for new apps and Nov 2021 for updates. Is it correct ?

1 Like

Yes that is correct, because writing in the folder /storage/emulated/0/Documents/ will no longer work on devices with Android ≥ 10 when AI2 is targeting Android 11.

1 Like

Will they stop to run even without modification on my part ?

1 Like

No, they will continue to run
Also it has been announced, that we will be able to access shared storage in future, see also

Taifun

There is currently no component that can save files in the external storage on devices with Android ≥ 10 (outside of the ASD, with the exception of the File component with Legacy mode; however, this is ignored under Android 11). In this respect, @patel must have used an extension for saving files in the external storage on devices with Android ≥ 10.

However, this is no longer possible under Android 11 (targetSdkVersion=30), because WRITE permission no longer exsits under Android 11. Therefore it will stop working on devices with Android ≥ 10 when AI2 targets Android 11 (Aug 2021).

1 Like

Hello Anke. My File1.LegacyMode block stopped working yesterday. Any suggestions ?

Thanks,

Carlos

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

Will send snapshot in 45 mins.

It is pretty simple. My local file procedure where i write or read or check for presence, must start with File1.LegacyMode True in order for File1 to work. It was recommended by you or Anke a few months back with the warning that it was going to stop working in a few month.

I guess a few months was yesterday. On err i check my blocks and LegacyMode block was floating by itself. It was not connected to a File1 control, so AI2 doesnt recognize it any more.

I deleted LegacyMode block and error warning disappeared but rest of File1 blocks failed, can't read/write or check for presence.

This is apparently an error of omission transitioning into nb187 File Scope handling.
There should probably be some extra code at app load time to transition the old blocks and attributes to the new system.

P.S. some manual conversion guidance from @ewpatton would help here in the meantime.

(added to FAQ)

  • On Android 10 devices requestLegacyExternalStorage will continue to work regardless of targetSdk
  • On Android 11 devices for new apps targeting SDK 30 requestLegacyExternalStorage is ignored / false.

The block before File1.Delete was File1.LegacyMode=True

As of yesterday, the LegacyMode block was disconnected from the do block, it was on its own on the board.

So the bad LegacyMode block is my fault. I marked the method as deprecated and the blocks editor handles this differently than it used to. I will need to write an upgrader to handle this correctly. In the meantime, you will want to replace the LegacyMode block with this:

2 Likes

It worked!!

Thank you,

Carlos

I can confirm, my old apps continue to access to documents folder, but I can no longer modify or recompile them.
No solution to date?

1 Like

Purtroppo..cmq io ho cercato di superare il problema..usando al posto di File..il caro e vecchio TinyDB.

try the SAF extension

Taifun

2 posts were split to a new topic: Importing a sqlite database in Android 11