Save Images From MitAppInventor To Firebase

Hello! I have problems saving images (.png) in firebase storage. I tried different extensions and blocks but none of them worked. I'm working on a DrawingApp, where I can save pictures on the phone and on firebase.
Here is the picture of the last blocks I used:
Blocks firebase

How can I solve this problem? Thank you

it looks like neither your filename nor your path is correct ...
try filename = my awesome picture
path = /storage/emulated/0/myImage.png

see also Firebase Storage Extension (Version 2) by Mirxtrem Apps

Taifun


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

I will try to change the blocks. Thank you

I treid to change the filename and the path but nothing happens. I still have an Error 1104.

I've already used the extension Firebase Storage, but I still have problems.

What can I change?
Thank you for your help

I have the same problem. I am able to save audio files but when I use the same firebase storage extension and block logic to save output pictures from canvas, it does not work :frowning:
Error 1104.
My blocks configuration is pretty similar to the one of Noemi_C, changing only the path and filename.

Here examples:

Also, if you want to just use a web component:

None of the answer brought me to the solution and others similar topics tell us that the probem spread all over the community. I SOLVED THE PROBLEM even if I did not understand the solution, anyway it works and it's stable. Here the way to save picture from canvas and share them with firebase:


The secret is to set a generic label (you can make it non visible) with the saving block of canvas (what sense is this blocking ment to have? [idk]). THEN you load the saved picture in a image component (also this can be non visible) but you have to recall the picture using the "doubled" directory (you will notice that this block setup brings to this wrong directory if you make the label visible [idk 2.0]). So you select the path of the file, in the firebase block, from the image component.
It also works without passing from the image component but sometimes it fails with the 1104 error code (????? [idx. the revenge]). I do not know if it's necessary to use the getASD1 component, conclusion at your try :wink:

There is probably no need for all of that.

For a device running Android 10, and using companion, these blocks save a canvas to the Companion "ASD", and using that path upload the file to Firebase Storage.

When compiled, you will probably need the ASD extension for Android 10+, unless you manually set your ASD before compiling.

If targeting < Android 10, your default canvas save path is /storage/emulated/0/file.jpg

edit: blocks for <Android 10. Tested in the same way but on Android 7.

image

TIMAI2 your setup does not work and error 1104 occurs every time. Canvas has a sort of saving issue I guess. I tried thousands of combination and technique. The only one that worked is showed in my previous message, and it is the only one that worked with companion and with the installed apk

Which Android version did you test on?

with you....:wink: Could be a timing issue, perhaps add a clock timer between saving the image and uploading ?

I have added blocks that work for Android<10 to my previous post

I am working with Android 10. I saw your precious post but it didn't help me :frowning:

No I have already tried a clock solution and also to split the action in two buttons but nothing changed. Your solution, in my phone, works with audio files or pictures from other components. When canvas is used the problem arise. Anyway, lot of people are having my same problem and no solution have been provided in many q&a... So that is a further solution and I hope it will help in future :wink:

These blocks make no sense and this is not a reasonable solution at all.
Very long paths are generated unnecessarily:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/orange.jpg

If you save the image as @TIMAI2 suggested, first check whether this image exists. If so (and it will be there), try to set the path for Firebase like this for API ≥ 29 (Android 10+):

I checked it on one of my Android 11 devices with Companion. No issues at all.

PS:

I really feel the same way. :wink:

Try this (tested on Android 9, 10, 11 devices with Companion & APK without any problems):

Have you tried my approach? @Noemi_C @Fulvio_Cordella
If so, does it work? I think so. If I don't get an answer to this, I'll remove the Solution marker as this might confuse others and it is not a suitable solution.

Hi, I'm sorry but I am not able to try your solution due to technical problems. So, thank you for your time and remove the solution if you mind. I'll try as soon as possible to give you feedback. Thank you again :slight_smile:

1 Like

Hello, I've tried your way but it doesn't work. No error is showed and the savage seems to work. But when I open the firebase storage bucket the picture is not in. I tried with apk only because the companion is having problems recently :frowning:

Strange, because I

Did you create a new project and use only my blocks?