IMAGE_CAPTURE with Activity Starter

Hi! I would like to use android.media.action.IMAGE_CAPTURE in Activity Starter.
I know there is a Camera component, but there is no "when cancel" option - and I really need this.

When I use image_capture the camera is opening, I can take photo but the result is null. I mean there is no result in AfterActivity. How can I make this? Should I change ResultURI or something?
I hope you can help me.
Thank you.

Uri should be returned as ResultUri.

Unfortunately it is not. The ResultUri is just "". :frowning:

Oh wait...it will return captured image as bitmap which needs to be saved in order to get file path.

Thank you for reply. But is there any easier way to make this? Without coding - only in AppInventor? I don't think I am good enough to understand anything from your link :smiley:

You can try:
com.sunny.CameraIntent.aix (8.5 KB)

@vknow360 after using your extension error got

Obviously it will not work in Kodular.

Hello Oliwier

Have you tried App Inventor's own Camera Block?

Thank you for extension! But it looks like AfterActivity block is not working. After taking picture even the notifier doesn't show any message. CancelActivity works very well!
Am I doing anything wrong?

Yes, but as I said in first post, there is no option like "CameraCanceled", so App Inventor's Camera Block is not useful for me.

A line was missing there.
This is working:
com.sunny.CameraIntent.aix (8.6 KB)

I am not sure about front and rear camera.

1 Like

Now it works like a charm!
Front and rear camera also is working well!

Thank you very much Sunny! :heart_eyes:

1 Like

Sunny, unfortunately in compiled app, instead of .AfterActivity it triggers .ActivityCanceled :frowning:
In Companion everything is working well, but when App is compiled it always goes for .ActivityCanceled, even after taking picture.
Could you help me with this please?

Sure, I shall check.

1 Like

Which Android version does your test device have?

I assume Android 11 (or 10+), because
APK is not working on Android 11 @vknow360.
The .AfterActivity event is not triggered.

I use Android 10. Maybe I wrote something wrong - app is installed, opens and everything is working OK. But the problem is when I am using extension from @vknow360, camera opens and then it doesn't matter if I take photo or if I click cancel, it triggers only .ActivityCanceled
In Companion it is working well, on the same testing device.

Yes, I understood that. As I wrote it is not working on Android 11 with the APK.
It's working fine e.g. on Android 9.

@Oliwier @Anke
Can you post the logs?

This works fine as reported by @Oliwier
Aix: com.sunny.CameraIntent.aix (9.9 KB)
Java: CameraIntent.txt (5.3 KB)

4 Likes