This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

Hello guys,
A few days ago, I want to call Android native camera in my project, but can't find any tutorial, so I decided to try to solve this problem.
Step 1. Create a Activity which can access the front camera and take picture.
Step 2. Create a Singleton(extends Godot.SingletonBase), which have a method "open", and it can start the new Activity.

Here are the screenshots

But the new questions appeared:
Q1: When the camera take a picture, and saved it, how can I accesse in GDScript ?
Q2: When the camera take a picture, and finished the activity, how to notify GDScript, may be a calback function ?

Java Code

   public void open() {
    Intent intent = new Intent();
    intent.setClass(activity, CameraCallActivity.class);
    activity.startActivityForResult(intent, CAMERA_REQUEST_CODE);

protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CAMERA_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            toast("Take Picture Success");
            // TODO need to notify
        else {
            toast("Take Picture Cancel");

GDScript Code

func _on_open_camera_pressed():
   if not Globals.has_singleton("CameraSingleton"):

   var single = Globals.get_singleton("CameraSingleton")
   #need to get the picture as a head image
in Engine by (86 points)

Did you get any further result?

Help needed. Were you successful in trying to store and access the pictures from the camera?

I have the same problem :c

1 Answer

+1 vote

I'm no java developer expert, but I think you should integrate your code with something like:


by (1,488 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.