I am reading a file from the internet (with a single slash) and a file that I have imported into the media section of Mit App Inventor (with a double slash). My app is working on my own Android device but it is not working on another Android device when I export my app to another computer. Could there be a problem in reading any of the two files when I export my aia file?
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 Taifun.
My app is able to run on my own Android device but not on another Android device. Would you like me to send my app's aia file?
does that file not have any file extension like .txt or .csv?
you might want to set the property ResponseFilename of the web component and use the fileName parameter in the GotFIle event to read that file
http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web
is the other device an Android 10 device?
how do the FIle1.GotText and File2.GotText events look like?
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
Find information about File and Web components.
http://ai2.appinventor.mit.edu/reference/components/storage.html#File
http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web
On devices with Android ≥ 10 this path (fileName) (/Coviddata.txt
or /Coviddata.csv
) points to the ASD (app-specific directory):
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Coviddata.csv
On Android < 10 this path points to (the root directory of the external storage):
/storage/emulated/0/Coviddata.csv
In other words: Since targetSdkVersion = 29 (AI2 update nb184) it is no longer possible to access the external storage outside of the ASD on devices with Android ≥ 10 (API ≥ 29).
See also here:
Nevertheless, WRITE / READ permissions are requested from the File component, even if a file is saved in the ASD and is to be read from it. This is a bug. @ewpatton
That can currently only be bypassed with the EFile extension from @vknow360. See also here:
I will do a PR.
P.S. Done
Means? Please explain ...
I mean this:
Just to clarify: my app may not function correctly if I test it on an Android >= 10?
No. We need to know where the textFile "Coviddata" (should be
Coviddata.txt or
Coviddata.csv`) comes from.
Did you create (save) this file by the File component?
Here is the full link to the set Web1.url block: https://usafactsstatic.blob.core.windows.net/public/data/covid-19/covid_confirmed_usafacts.csv
Android 11 (Beta):
The file "Coviddata" is 2 MB, so it takes some time (several sec) to get the text.
So where is the problem?
I'm just trying to figure out why my app wasn't working on one android device but working on another android device. So importing the files doesn't seem to be a problem, right?
What exactly does not work. As you can see it's working even on Android 11.
I think I figured out the problem - some setting had to be enabled on the Android device and now my app works on the device.