Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-1065

App crashes after taking a picture with the camera

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 1.8.0, 1.8.1, 1.9.0
    • None
    • cordova-android, cordova-js
    • None
    • Android Smartphone with Android v. 4.0.3 using phonegap 1.9.0

    Description

      Hi,

      I found a bug in phonegap during tests on my android-device (Samsung Galaxy S2 with android 4.0.3 - the bug does not appear on my other test device (Samsung Galaxy S3 with Android 4.0.4):
      In my app (can only be used in portrait mode), I'm using the camera.getPicture-functionality - after a click on the 'take a picture'-button in my app the camera app starts, the user can take a picture, after that the camera app asks if the user wants to keep the taken picture or discard it - so far so good.
      When the user takes a picture in landscape-mode everything is fine, the taken picture is available in the onSuccess-method.

      The problem is: If the user takes the picture in portrait-mode and the camera-app tries o give the picture back to my app - it crashes, that means: onFail will not be called, both apps (camera-app and my app) close without a message and android shows the homescreen.

      Please find attached my code and the errorlog:

      My code:

      function onFotoSuccess(imageData)
      {
      $('#cameraFoto').attr(

      {src:"data:image/jpeg;base64," + imageData}

      );
      }

      function onFotoFail(message)
      {
      alert('Failed because: ' + message);
      }

      $("#fotobutton").on("click", "", function()
      {
      navigator.camera.getPicture(onFotoSuccess, onFotoFail,

      { quality : 90, destinationType : Camera.DestinationType.DATA_URL, sourceType : Camera.PictureSourceType.CAMERA, allowEdit : true, encodingType: Camera.EncodingType.JPEG, targetWidth: 1024, targetHeight: 768, popoverOptions: CameraPopoverOptions, saveToPhotoAlbum: false }

      );
      });

      My log - hope it helps:

      07-06 11:16:44.213: V/webview(19169): singleCursorHandlerTouchEvent -getEditableSupport FASLE
      07-06 11:16:44.553: I/GATE(19169): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
      07-06 11:16:44.553: D/Cordova(19169): onPageFinished(file:///android_asset/www/index.html#pageDegustationStart)
      07-06 11:16:44.553: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:16:44.558: D/DroidGap(19169): onMessage(onNativeReady,null)
      07-06 11:16:44.558: D/DroidGap(19169): onMessage(onPageFinished,file:///android_asset/www/index.html#pageDegustationStart)
      07-06 11:16:47.923: D/dalvikvm(19169): GC_FOR_ALLOC freed 237K, 6% free 10361K/10951K, paused 30ms
      07-06 11:16:47.958: D/dalvikvm(19169): GC_FOR_ALLOC freed 3K, 5% free 10430K/10951K, paused 20ms
      07-06 11:16:47.988: D/dalvikvm(19169): GC_FOR_ALLOC freed 1K, 5% free 10569K/11079K, paused 14ms
      07-06 11:16:48.508: V/webview(19169): singleCursorHandlerTouchEvent -getEditableSupport FASLE
      07-06 11:16:49.003: V/webview(19169): singleCursorHandlerTouchEvent -getEditableSupport FASLE
      07-06 11:16:51.373: V/webview(19169): singleCursorHandlerTouchEvent -getEditableSupport FASLE
      07-06 11:16:51.818: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:16:52.553: W/IInputConnectionWrapper(19169): showStatusIcon on inactive InputConnection
      07-06 11:17:00.313: D/DroidGap(19169): onDestroy()
      07-06 11:17:00.313: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:00.318: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:00.338: D/DroidGap(19169): DroidGap.onCreate()
      07-06 11:17:00.363: I/webclipboard(19169): clipservice: android.sec.clipboard.ClipboardExManager@4164fd60
      07-06 11:17:00.368: D/CordovaWebView(19169): Origin to allow: http://127.0.0.1*
      07-06 11:17:00.378: I/CordovaLog(19169): Found log level DEBUG
      07-06 11:17:00.378: I/CordovaLog(19169): Changing log level to DEBUG(3)
      07-06 11:17:00.393: D/DroidGap(19169): DroidGap.init()
      07-06 11:17:00.393: D/CordovaWebView(19169): >>> loadUrl(file:///android_asset/www/index.html)
      07-06 11:17:00.393: D/PluginManager(19169): init()
      07-06 11:17:00.398: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:00.398: D/WML_SISO(19169): InitPasteboardJni
      07-06 11:17:00.398: D/SoftKeyboardDetect(19169): Ignore this event
      07-06 11:17:00.428: D/SoftKeyboardDetect(19169): Ignore this event
      07-06 11:17:00.428: W/webcore(19169): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2404)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.WebViewCore$EventHub.access$12300(WebViewCore.java:1180)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2516)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.WebView.sendOurVisibleRect(WebView.java:3212)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:938)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.ZoomManager.access$2100(ZoomManager.java:57)
      07-06 11:17:00.428: W/webcore(19169): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1407)
      07-06 11:17:00.428: W/webcore(19169): at android.os.Handler.handleCallback(Handler.java:605)
      07-06 11:17:00.428: W/webcore(19169): at android.os.Handler.dispatchMessage(Handler.java:92)
      07-06 11:17:00.428: W/webcore(19169): at android.os.Looper.loop(Looper.java:137)
      07-06 11:17:00.428: W/webcore(19169): at android.app.ActivityThread.main(ActivityThread.java:4507)
      07-06 11:17:00.428: W/webcore(19169): at java.lang.reflect.Method.invokeNative(Native Method)
      07-06 11:17:00.428: W/webcore(19169): at java.lang.reflect.Method.invoke(Method.java:511)
      07-06 11:17:00.428: W/webcore(19169): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
      07-06 11:17:00.428: W/webcore(19169): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
      07-06 11:17:00.428: W/webcore(19169): at dalvik.system.NativeStart.main(Native Method)
      07-06 11:17:00.428: D/SoftKeyboardDetect(19169): Ignore this event
      07-06 11:17:00.463: D/SoftKeyboardDetect(19169): Ignore this event
      07-06 11:17:00.473: W/webcore(19169): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2404)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.WebViewCore$EventHub.access$12300(WebViewCore.java:1180)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2516)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.WebView.sendOurVisibleRect(WebView.java:3212)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:938)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.ZoomManager.access$2100(ZoomManager.java:57)
      07-06 11:17:00.473: W/webcore(19169): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1407)
      07-06 11:17:00.473: W/webcore(19169): at android.os.Handler.handleCallback(Handler.java:605)
      07-06 11:17:00.473: W/webcore(19169): at android.os.Handler.dispatchMessage(Handler.java:92)
      07-06 11:17:00.473: W/webcore(19169): at android.os.Looper.loop(Looper.java:137)
      07-06 11:17:00.473: W/webcore(19169): at android.app.ActivityThread.main(ActivityThread.java:4507)
      07-06 11:17:00.473: W/webcore(19169): at java.lang.reflect.Method.invokeNative(Native Method)
      07-06 11:17:00.473: W/webcore(19169): at java.lang.reflect.Method.invoke(Method.java:511)
      07-06 11:17:00.473: W/webcore(19169): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
      07-06 11:17:00.473: W/webcore(19169): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
      07-06 11:17:00.473: W/webcore(19169): at dalvik.system.NativeStart.main(Native Method)
      07-06 11:17:00.513: D/DroidGap(19169): onMessage(onPageStarted,about:blank)
      07-06 11:17:00.593: I/GATE(19169): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
      07-06 11:17:00.593: D/Cordova(19169): onPageFinished(about:blank)
      07-06 11:17:00.593: D/DroidGap(19169): onMessage(onPageFinished,about:blank)
      07-06 11:17:00.593: D/DroidGap(19169): onMessage(exit,null)
      07-06 11:17:00.638: D/DroidGap(19169): onMessage(onPageStarted,file:///android_asset/www/index.html)
      07-06 11:17:00.638: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:00.828: D/DroidGap(19169): onDestroy()
      07-06 11:17:00.828: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:00.828: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:01.188: I/GATE(19169): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
      07-06 11:17:01.188: D/Cordova(19169): onPageFinished(file:///android_asset/www/index.html)
      07-06 11:17:01.193: D/CordovaWebView(19169): >>> loadUrlNow()
      07-06 11:17:01.193: D/DroidGap(19169): onMessage(onNativeReady,null)
      07-06 11:17:01.193: D/DroidGap(19169): onMessage(onPageFinished,file:///android_asset/www/index.html)
      07-06 11:17:01.228: D/DroidGap(19169): onMessage(onPageStarted,about:blank)
      07-06 11:17:01.253: I/GATE(19169): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
      07-06 11:17:01.253: D/Cordova(19169): onPageFinished(about:blank)
      07-06 11:17:01.253: D/DroidGap(19169): onMessage(onPageFinished,about:blank)
      07-06 11:17:01.258: D/DroidGap(19169): onMessage(exit,null)
      07-06 11:17:01.978: W/IInputConnectionWrapper(19169): showStatusIcon on inactive InputConnection
      07-06 11:17:03.198: D/DroidGap(19169): onMessage(spinner,stop)
      07-06 11:17:03.268: D/DroidGap(19169): onMessage(spinner,stop)

      Additionaly I tried it with FILE_URI but unfortunatly without success (please have a look at: https://groups.google.com/forum/#!msg/phonegap/O06ITzYa-lI/XXFtLyfgehYJ )

      It would be great if somebody could fix this issue...

      Kind regards,
      carpetempora

      – Posted from Bugbox for Android

      Attachments

        Issue Links

          Activity

            People

              bowserj Joey Robert Bowser
              carpetempora trace0815@googlemail.com
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: