I am having considerable difficulty displaying a photo on the app screen and saving it to the device’s memory. In my app, I need to take a photo and display it on the screen, and at the same time, it’s necessary to save that photo in the device’s internal memory. Using the “Take Photo” flow function, I am not succeeding in setting two page variables at the same time. Is there a way to do this? In the case of the print below, the app saves the image in a folder on the device, but does not display it on the screen.
I discovered a way to do this, below follows a step-by-step guide so that if someone in the future has the same question as I did.
First, it is necessary to create a page variable to store the photo information. This variable is an object with 6 properties, which are exactly the properties needed to generate a photo, as shown in the print below:
Second, you will have to create a logical flow that takes the information from the “Take Photo” function to the page variables, one that will be displayed on the screen for the user and another to be saved on the device. You must have imagined that the page variable to be stored on the device is the one that carries the information of the photo’s “file”. Below is the flow that creates two page variables that store the information from the “Take Photo” function at the same time:
Let’s look in more detail at each of these flows:
1 - Take Photo: Here I didn’t edit anything, but it’s important to note that the output of this flow is an object with the photo’s properties.
2 - Move/rename file/directory: In “Source file path” you should put as Output value of another node the property “path” from the “Take Photo” flow. In “Target file path” the location on the device where the photo should be saved, as an example, here is the code I used:
“/storage/emulated/0/Download/R3 Downloads/Images/” + pageVars.varODS_numPatri + “-1” + “.jpg”
3 - The output of the Move/rename file/directory flow is a file with the same properties that you created in the page variable. Therefore, it is necessary to send this information to this variable as in the print below:
4 - Finally, you can set the page variable that will be displayed on the screen, but with the Assigned value being the output of the Move/rename file/directory, as in the print below: