Permission causes app to crash?

attached is the aia if you want to test, export and import is located on the settings2 page

I would test a simple aia with the problem you have, not an aia with many screens.

1 Like

you have to start your tests from the beginning... store the file in ASD (using file scope App) and read it from there
file scope should be App
default file scope should be Legacy

you can access the file for example using total commander, see also

Taifun

The problem is I can see the file but the app can no longer find the file when it's stored using the app path

are you testing using the companion app? just delete the file and restart your tests
first store it in ASD and then read it from there

Taifun

Nope I am using the downloaded app. I see the file stored in the apps directory under files. Yet when I try to read the file it says it can't find it. It's searching for the same file name in the same folder. I tried deleting the file and restarting the process, same thing.

Yet when I had the scopes all set as legacy it was able to find the file fine and it was stored outside of the app directory

follow @patel 's advice

and if you still got issues with the test project as small as possible, then post it here into this thread, so someone can take a look

try to read it only with the filename PVBackup.txt (i.e. without leading slash)

Taifun

I am sorry but how would that change anything ? The rest of the app works fine and has been working fine for a while. This is the only new addition so the only problem can be in the reading and writing the file and an issue with accessing the ASD. After reading a few other posts about the file component it seems you can't read a file from the ASD anymore from what I understand so I will have to go back to using legacy and just try to figure out why accepting the permissions causes the app to crash.

Yes I tried without the / as well. Same issue.

well, if something is not working, someone else can take a look at your simple test project...
I myself will not download a complex app to do some bug hunting, but probably you will find someone else, who likes to do that...

this is incorrect

Taifun

OK I still don't understand the reasoning about the aia file but okay I must of misread/understood the post I was reading about reading from the asd.

Well I thought I would try one last thing which was to clear the app data and uninstall completely then re download it(instead of pushing updates to the app) and now it's decided that it wants to work. So I have no idea but it seems to work now?

Everything you said in this thread makes no sense at all.
I took a closer look at your aia. In this aia you set DefaultFileScope = App and also FileScope = App (and both permissions READ / WRITE enabled in the Designer for the File component). This means that all files saved via the File component are saved in the ASD (under all Android versions. However, READ & WRITE permissions are only required for Android < 4.4 (API 19, KitKat).

So I removed the Solution marker (from your post #19) because uninstalling and reinstalling the app is definitely not a solution. This will only confuse others (and obviously yourself, by the way).

See also here.

I was just stating what worked for me. I didn't change anything from the app but it seemed to work after that.

As for the read and write I was just following an online guide and they had those ticked so I did the same.

Here is a simple test aia, that saves a text file in the ASD on all Android versions:
ReadWriteToASD_extVer2.aia (8.6 KB)

grafik

Blocks

Note: READ/WRITE permissions are only required on Android < 4.4 (API 19, KitKat). So I used version 2 of my extension. It's sufficient to ask for WRITE permission because it implicitily grants READ permission as wll.

Please post the link to this quide.

So I looked at your example test app that you provided and I see that you have used the exact same setup for the file as me except with read and write permission options not selected. So this doesn't relate to the problem I was having really, as like I said it was able to write the file okay and the file was visible in the ASD its just wasn't able to find it using the same path for some reason. Yet when I reinstalled it just worked and was able to find the file fine. Not sure what you meant by Nothing I wrote makes sense as what I said was what was happening !

As for linking the guide I mentioned, it was just a video I saw of someone using the file component from YouTube, if I have some free time I will try find it again and link it here.

If like you say the read write permissions don't need to be selected unless using an older version of android maybe that should be mentioned on the storage documentation page:
http://ai2.appinventor.mit.edu/reference/components/storage.html#File

But even though your provided file wasn't exactly a solution I did implement you extension that you used in your screen initialize to prevent issues for other users so thanks for that.

Then it should be possible to reproduce the problem. I doubt that.
So post an example (aia).

In what respect, what did not work?

I am not gonna waste my time trying to reproduce a bug , just because you think I am making it up (why would I waste peoples time by lying about an issue I was having?)

Your aia is not a solution to the problem I mentioned as its does exactly the same thing as my file. There is no difference except the read write permissions, but like I said mine ended up working with those selected so seems like that was not what was causing the issue.

But you wasted our time by talking about a bug that doesn't exist.

However, that is the question. But I didn't claim that you were lying, I guessed that you were wrong and this error actually does not occur.