Base64 extension help

In this topic, examples of Base64 extension (updated):

Variable image in Camera is:
file:///storage/emulated/0/My Documents/Pictures/app_inventor_16344444.jpg [ MIT Companion ]
file:///storage/emulated/0/Pictures/app_inventor_16344444.jpg [ Android <10 ]
file:///storage/emulated/0/Android/data/'namepackage'/files/Pictures/app_inventor_16344444.jpg [ Android >=10 ]

Simplified example:

Base64_Direct_ASD.aia (44.7 KB) [it works installed]

1 Like

Why ... ?

This is just an exercise, an example. It is about saving an image in a TinyDB, retrieving it from the TinyDB and putting it in a Picture.

This doesn't return a value with Companion.

Only installed.

I understand that, but it's totally unnecessary in this case.

My test APK PhotoBase64a.apk works also with Companion.

This example can also be adapted to work with Companion.
Does your app.apk work with Android <10?

Yes, now it works on all Android versions.

I don't have Android 11,
can you please test if my app works installed on a real Android 11?
Base64_Direct_ASD.aia (44.7 KB)

Here is the APK (works also on Android < 10):

please provide aia projects as well.

First day back - since Oct 21st I have had a very nasty fall (still have the scares to show for it) and followed that up by catching a cold bug that has been very tough to shake off - wife and I are still at about 60% of our normal energy levels (both tested for covid).

Going to try out the various projects. I have been able to extract Exif data via javascript in a Browser (files on my server just to test), so the main task is to convert photos on-the-fly to B64 and pass that string to the script, all-in App (no internet required).

Your APK works Anke, I can switch between encoded and decoded. How are you encoding from:

file:///storage/emulated/0/Android/data/appinventor.ai_bodymindpower.Photobase64a/files/Pictures/app_inventor_1636543773235.jpg ?

If I test with the App Inventor camera component, it produces a similar path:


...but Juan's Base641 extension returns "File not found", so the B64 string is not created.

Edit: Ah - you move the file :koala:

......Nope, moving the file alone is not the answer, Juan's FileToString still returns 'File Not Found'. Android 11, APK:


Try FileToStringASD

Thanks Juan, will try that. I'm completely brainless at the moment :smiley_cat:

Same result, APK Android 11: 'File Not Found'. In the linked Topic, luc74 also gets the same result....

The Android 11 path to the photos saved by the camera does actually match the path hint on the FileToStringASD Block:


The only difference is the image format (jpg vs png)? Or is it wrong to give the Block the full path? I have also tried just the file name thus:
/app_inventor_1636635491819.jpg but it is not found.

Now, most people will probably establish an App Folder specifically for the photos produced by their App - my path example:


OK, finally working. Both App Inventor's Move File and KI0R_Base641 need a partial folder path. Why I couldn't see it before? baseball-bat-smiley-emoticon

I'm also using png instead of jpg but that depends on the camera used.

Saved by the App Inventor Camera Component:

Moved to:

B64 Snippet:


GET_EXIF.aia (43.1 KB)

Currently not getting the Exif data returned, though it works well on a PC.

1 Like

you should set your webviewstring before calling the html page.

1 Like