Camera::take_picture not working

14 views
Skip to first unread message

Poonam Sharma

unread,
Sep 1, 2015, 4:07:11 AM9/1/15
to rhomobile
Hi,

This is my code to open camera and save Image for android phone. In Rho Simulator, I am getting default value for Camera info but after installing in Phone nothing is happening (camera code is not working) and Camera_info also coming blank.

Note that i am using free rho studio (5.1)  not the licensed one. 


def CamCall
    $main_info = Camera::get_camera_info('main')
    Alert.show_popup("Camera info : #{$main_info}")    
    Camera::take_picture(camera_callback)
  end
  
  def camera_callback
    Alert.show_popup("Manifest Alert : #{@params['status']}")
    if @params['status'] == 'ok'
          #create image record in the DB
          image = Image.new({'image_uri'=>Rho::Application.relativeDatabaseBlobFilePath(@params['image_uri'])})
          image.save
          puts "new Image object: " + image.inspect
          if (((System::get_property('platform') == 'ANDROID') || (System::get_property('platform') == 'APPLE')) && ($use_new_api))
               img_width = @params['image_width']
               img_height = @params['image_height']
               img_format = @params['image_format']
               puts "Captured Image  Size: #{img_width}x#{img_height}, Format: #{img_format} "
          end
        end            
       





Thanks.
Reply all
Reply to author
Forward
0 new messages