Android: CameraPicker & ImagePicker

Monkey Programming Forums/User Modules/Android: CameraPicker & ImagePicker

Ironstorm(Posted 2014) [#1]
Hey guys!

Now I've managed to document my module. Here it is.
With this module you'll be able to get access to the camera and the image gallery of an Android device. Next step is to implement the iOS and WinPhone target.

I've added two examples for each. For more infos, just read the documentation.

Here the Git-Repo:

Aman(Posted 2014) [#2]
Nice work. will test it soon

Gerry Quinn(Posted 2014) [#3]
Cool - I downloaded some Java code a while ago intending to develop something like this, but I never got around to it!

CopperCircle(Posted 2014) [#4]
Sounds good, thanks.

Amon(Posted 2014) [#5]
Will test in a bit, thanks!

CopperCircle(Posted 2014) [#6]
Hi, the image picker works great on my Nexus 7, I could not get the camera picker to work, I added the CAMERA permission but still does not open the camera.

EDIT: It is fine if I remove If camerapicker.HasCamera()

Ironstorm(Posted 2014) [#7]
Ah, sorry. Forget to check if the device has only a front-facing camera. HasCamera() only checks for a rear-camera.

I've updated the repo. HasCamera() should now return true if there is any camera available.

Duke87(Posted 2015) [#8]
@Iron, are you still working on this?

Could need some help.
I'm working on an App, which basically shall take a Picture and store it to the sd-card into a specific folder.
As i see, your module should basically to so. But, I've a really weird problem over here.
My Code is like the following:

Method startCam:Void()
#If TARGET="android"
If camerapicker.HasCamera()
Local currDate:Int[] = GetDate()
imagename = "DCIM/MyFolder/"+currDate[0]+"_"+currDate[1]+"_"+currDate[2]+"_"+currDate[3]+currDate[4]+currDate[5]+"_Pic"
camerapicker.OpenCameraPickerAsync(imagename , Self) ' Check if device has camera, if so open the camera
Print "Not running on Android"
End Method

#If TARGET="android"
Method OnCameraPickComplete:Void(result:String)
If result <> "" Then
Print "result: " + result
LoadImageAsync(result, 1, Image.DefaultFlags, Self)
End Method

Method OnLoadImageComplete:Void(image:Image, path:String, source:IAsyncEventSource)
Print "path: " + path
If path.Contains(imagename) Then
'Print "Loaded Picture: " + path + "."+imagename
MyPicture = image


So, my hope was, it will store the pictures on my SD, but it doesn't.
Secondly, my Phone couldn't load the Picture... it's always null (within Monkey App), So when i search on my phone via FileMananger on Android i see it created a folder called "DCIM/MyFolder/..." (internal) and it stored all taken pictures. the strange thing is, i can't open it on my Phone. But when i Copy the taken pictures to another Folder, then my Phone is able to load them. And when i link my Phone to my PC, i even can't see the "DCIM/MyFolder/...". Do you have any idea what the problem could be?
I just tested to do it as in your example too, but then i even can't find the taken pictures.
And yes, UpdateAsync and everything is running properly. when i tried your module with an older Phone (Android 2.3 or something) i remember, it run a little bit better.
But then it sometime didn't load async pictures correct, but they've been saved.

I'm Using Sony XPeria E3 with Android 4.4.4 if it helps.

Bye Duke