Base64 extension help

Yes, it needs to reinitialize the stream so that it can continue to display the preview.

2 Likes

Ah, that is why when I used a clock in the initialised event it kept on taking photos :wink:

1 Like

Try this APK:

It's a variable - for the garden birds, as rapid as possible. For my students project, every 5 - 10 minutes (front and back cameras). In both cases (+ others) no preview or any User activity (other than pressing 'start') required. Just like the Press photographers really, they can't see a preview, so they just blast a round off @ 1 per second.

So I'm mostly offline for the next few days, chasing channels in solid walls for new electrics. Amazing how heavy a 7kg machine becomes after 20 minutes work :grin:

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.

@Anke
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:

file:///storage/emulated/0/Android/data/appinventor.ai_chrisward2k2.GET_EXIF/files/Pictures/app_inventor_1636488884808.jpg

...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:
/storage/emulated/0/Android/data/appinventor.ai_chrisward2k2.GET_EXIF/files/PhotoFolderASD/1636561720268.jpg