I cannot display images located on the internal storage. Try moving it into other folders and nothing.
The path I use is:
/image.png
This path I assign to the image component but it does not show it. I do this via blocks.
When I use the notifier to show me the path of the image that has the image component it comes out:
/storage/emulated/0/imagen.png
As far as I understand the path is fine.
I hope they tell me what I can do to solve this or if it is a bug.
I use android 10 and MIT AI2 Companion 2.60
Before I had no problem with that. I was testing an application that showed me the qr code of a text and it worked correctly. The code was saved in an image and this is assigned to the image component
Also try with the compiled apk but it closes when i try open..
I attach the AIA file of the project. QR.aia (49.2 KB)
Google have introduced new Security measures that limit an App to using it's own folder/directory the "Application Specific Directory". That is where you can store and collect your images. Everyone has this same problem!
Hi ChrisWard.
I tried using that extension but it didn't work for me using that method. The QR extension does not recognize the path correctly.
The solution was to create a function that returns the path of the ASD file without the text "/storage/emulated/0". With that, the image could be saved in the application path and I could also show the image of the qr code.
I attach the aia where I modify everything. QR.aia (60.7 KB)
When I compiled the project into an apk and tried it on my phone it wouldn't open. It just closed.
I tried on my tablet with android 6 and the same thing happened.
I tried an emulator and the same thing happened.
I do not know what it could be.
I really don't understand what your App is for but I can see where the issue is. Note, Companion works because it is not subject to all the security rules.
qr.png is in the Assets (Media) folder of the App - that's OK, the App is stored there too, but it is a closed, secure area that only your App can access.
If the extension does not have access to the Assets folder, we must move the file to the ASD first. Taifun's file extension should work.
Not sure why you have a Procedure to remove '/storage/emulated/0/' as I think this is a legitimate part of the ASD path.........
I do not have the QR extension, so the attached code is untested, but this is the way it should work. QR_mod.aia (61.3 KB)
Hi ChrisWard.
My application generates a qr code of the text that you write in the text field.
The "qr.png" image that is in the assets is just a logo that I place in the middle part of the generated qr image.
The asset image has nothing to do with the qr image generated by the extension, the qr image is stored in the ASD after the changes made previously.
The path of ASD already exists so I don't have a problem.
The problem I have now is when I compile it into an apk and then install it I open it and it closes.
I also tried compiling your project but the application still closes. I get the message that the application has stopped.
I also delete all the images in assets.
Also place the Get Error Info blocks but the information is never displayed. This must be because the app closes before it fully loads.
It could be that the extension is out of date with the current App Inventor version. We do not use the extension until the button is pressed, so for it to cause a crash as the App is loading would seem to show an incompatibility or simply that App Inventor is expected to have something that it doesn't have (as an APK).
You could also try to capture the crash via logcat. I just tried that myself but in fact I can't get logcat to work on my Huawei Pro 30 - everything is in place, but logcat is "waiting for device".
The extension needs read and write permissions.
Also note that android 10 does not allow you to write in external storage.
Since the extension uses absolute path method so you should pass a complete path.