12 Replies Latest reply on Jun 17, 2014 11:13 PM by Bart Fukkink

    Camera API issues

    Bart Fukkink

      Hello again!

       

      We seem to have some issues when using RhoMobile and the Camera API on iOS and Android devices. We access the Camera with either of the following options:

       

      # When the user clicks the "Camera" button, we start the camera
      Camera::take_picture( callback_url, {} )
      
      # When the user clicks the "Add file" button, we start it with the file picker.
      Camera::choose_picture( callback_url, {} )
      
      # In both cases, the {} is an options hash with the default settings.
      

       

      This method for starting the camera is documented here: http://docs.rhomobile.com/en/2.2.0/rhodesapi/camera-api

       

      Now we run into 2 different problems. Lets see if we can solve this in one discussion:

       

      Android (RhoStudio 4.0)

       

      Using the "Add file" button with this method makes our app crash. We get the default crash message "<appname>  has crashed" and a close button. The only thing I can retrieve is this log message from the android logcat.

       

      03-11 15:00:32.256: E/AndroidRuntime(27596): FATAL EXCEPTION: main
      03-11 15:00:32.256: E/AndroidRuntime(27596): Process: com.viadata.connectit, PID: 27596
      03-11 15:00:32.256: E/AndroidRuntime(27596): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.viadata.connectit/com.rhomobile.rhodes.ui.FileList}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=27596, uid=10097 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.os.Handler.dispatchMessage(Handler.java:102)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.os.Looper.loop(Looper.java:136)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread.main(ActivityThread.java:5017)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at java.lang.reflect.Method.invokeNative(Native Method)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at java.lang.reflect.Method.invoke(Method.java:515)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at dalvik.system.NativeStart.main(Native Method)
      03-11 15:00:32.256: E/AndroidRuntime(27596): Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=27596, uid=10097 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.os.Parcel.readException(Parcel.java:1465)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.content.ContentProviderProxy.query(ContentProviderNative.java:413)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.content.ContentResolver.query(ContentResolver.java:461)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.content.ContentResolver.query(ContentResolver.java:404)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.provider.MediaStore$Images$Media.query(MediaStore.java:778)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at com.rhomobile.rhodes.ui.FileList.getImages(FileList.java:67)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at com.rhomobile.rhodes.ui.FileList.onCreate(FileList.java:94)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.Activity.performCreate(Activity.java:5231)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
      03-11 15:00:32.256: E/AndroidRuntime(27596):     ... 11 more
      

       

      I think this looks like a permission that is not set in the Android manifest. But shouldnt we have nothing to do with this?

       

      iOS (RhoStudio 2.2 and 4.0)

       

      Whenever a user starts the camera and takes a picture, this picture gets turned sideways and has a huge black square on it. An example would be this:

       

      2014-03-11_13.35.41.jpg

       

      This is a picture taken in an application made with RhoMobile from an iphone, and I can tell that my collegue normally does not look like this

       

      Can anyone provide me with some information about these issues?