Camera pictures are corrupted on Android

N Nicolas Hinze 2 years 11 months ago
3 0 0

A user is reporting corrupted camera images (See the attachement for an example). What could cause this?

Configuration:
- Rhodes 5.0.25
- Android 5.0.1 on LG Nexus 4
- SDK 4.4.2
- minSDK 17

Source code capturing the picture:

  # Get picture of fence 
  def take_a_picture
    settings = {:desired_width => 1280, :desired_height => 1280, :flash_mode => 'auto'}
    Camera::take_picture(url_for(:action => :camera_callback_new), settings)
  end

  def camera_callback_new
    if @params['status'] == 'ok'
      #create image record in the DB
      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.to_s+'x'+img_height.to_s+', Format: '+img_format
      end
      WebView.execute_js("camera_callback_new('" + Rho::RhoApplication::get_blob_path(@params['image_uri']) + "','" + @params['image_uri'] + "');")
    elsif @params['status'] == 'error'
      alertSettings = Hash.new
      alertSettings['message'] = @params.to_s
      alertSettings['title'] = Localization::Fence_controller[:camera_error]
      alertSettings['buttons'] = [Localization::Fence_controller[:ok]]
      alertSettings['type'] = [Rho::Notification::TYPE_DIALOG]
      Rho::Notification.showPopup(alertSettings)
    end
    render :back => 'callback:' + url_for(:action => :donothing)
  end

Is the camera API available in Rhodes 5.0.30?

CONTACT
Can’t find what you’re looking for?