Problem with July 30 2020 Version: nb184 no longer able to write and read files

I found the
http://pr2268.ai2-ewpatton-temp.appspot.com/#5699303985119232 easier to use, however the claim for suitable Companion as posted does show any result
cf..ewpatton.pdf (251.8 KB)
The Android10 my Samsung TAB A tablet runs on is no obstacle, so I am at a loss about all the Android10 discussion here.
And I have the suspicion that the flle1 help for storing, reading files, hence /file.ext or //file.ext or only file.ext must origin from old ages and is in need to be updated-
Wünsche ein gutes Wochende. und herzlichen Dank für die profunde Hilfe, beste poweruserin
H. Bücher, Mannheim

Well what exactly have you tested with companion 2.59dev1u that doesn't work as expected? Did you check the LegacyMode option for the File component? LegacyMode will make it work using the old paths (pre-nb184) whereas leaving it unchecked will give you the nb184 behavior.

Surely it should still be possible in future for Apps to read files that were downloaded and stored in the download directory? Any idea how that will work, or is it possible with nb184 already?

The end result is not far-off what malicious apps do - render the device less useful. I think it is a lazy approach by Google, they need to make more effort to weed-out malicious Apps. Especially the ones that are actually distributed via Google Play.

Unfortunately, we're a team of four developers against a corporation with a trillion dollar market cap. We need to comply with the store policies otherwise App Inventor won't be available any more, which is arguably more damaging than some folks losing access to files they could just copy to more appropriate locations (and who would also lose out if App Inventor goes away).

In nb184a we are adding a LegacyMode option that will allow this. However, it's possible that it will break in a future version of Android as Google continues to tighten its file access policies.

I checked this with my testStorage_API29.apk (→ GoogleDrive link above) an a Google Pixel 2XL (runing Android R, 11 Beta). It works without any issues (using TaifunFile & EFile extension).
@Taifun @vknow360

The folder

/storage/emulated/0/myDir

is created and the text files are saved in and read from this folder.

Right, but if you install the app fresh on Android 11 once App Inventor targets SDK 30 (it only targets SDK 29 right now), then you won't be able to create myDir because it is not in scoped storage.

Edit: More specifically, to ease the transition App Inventor includes the requestLegacyExternalStorage flag in the manifest so that apps can still access files outside of scoped storage. Once apps target Android 11, this will be ignored (ref):

Edit 2: There is also preserveLegacyExternalStorage, which we will turn on when we target SDK 30, but this only holds if the app was installed on the device prior to upgrading to Android 11 and the grandfathering in of the permissions model goes away if you uninstall and then install fresh the app:

1 Like

Ok thanks, I want to check that, but when I set targetSdkVersion="30" in the Manifest, the app is not installed.

Do you see any errors in adb logcat about why it's failing when the target SDK is 30?

Ok, I'll check this later and report ...

I have now used a different de- / recompile tool. That worked. And yes you are right, it only works for the ASD. What I will test later is the private directory:

/data/user/0/<packageName>/files/

Here are the results of my tests on a Pixel 2XL (Android 11 Beta):

android:targetSdkVersion="30"

Manifest

Blocks

As shown in this video, when I save a text file in

  • the Private directory or
  • in the ASD

it doesn't work with the File component without WRITE permission. But it works with the EFile extension (as it should!).

In addition, if the first button (copy dummy.txt ...) is clicked, you get this error, although the file was saved correctly (in the Private dir, and not in the root dir of ext. storage):
grafik
To check this on your Android 10, 11 devices:

More and more complicated, my head explodes :crazy_face:
so,
if i must write/delete or rename a file in this position?

/storage/emulated/0/Android/data/(packageName)/files/xxxxxx.txt

I am not clear if this path will work?
I use it on Android10 by extension TaifunFile and work well
Regards
Angelo

2 Likes

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