Exiting app after take picture

When I call the native camera, after accepting the picture taken, the application often exits to the previous openned app or to the android home screen. Sometimes it opens the app again, but is not the most common thing to happen.
It does not trigger any errors.
just exits the application.

It occours less in the moto x play with android 6.0
but in cellphones with android 5.0 and 4.4 the most common thing is to exit the app after take the picture.

Hi Wilton,

with the information you’ve supplied it’s hard to tell anything. Could you try running the app preview with fuse preview -tandroid from Terminal (console) and see if anything is thrown there after you take the picture?

Hi Wilton, try changing the quality of the photo. Sometimes a big quality causes OOM exception.

@uldis Later I post a detailed log (:

  • Device: Galaxy S5 (SM-G900M)
  • Android version: 5.0
  • Picture size: (16M) 5312x2988
W/ContextImpl( 6852): Failed to ensure directory: /storage/extSdCard/Android/data/mx.qmarketing.futuromexico/cache
I/art     ( 6852): Background sticky concurrent mark sweep GC freed 4688(268KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 85MB/85MB, paused 579us total 275.888ms
I/art     ( 6852): Background partial concurrent mark sweep GC freed 2647(99KB) AllocSpace objects, 1(64KB) LOS objects, 15% free, 85MB/101MB, paused 619us total 497.535ms
I/art     ( 6852): Alloc sticky concurrent mark sweep GC freed 7(416B) AllocSpace objects, 0(0B) LOS objects, 8% free, 85MB/93MB, paused 638us total 5.285ms
I/art     ( 6852): Alloc partial concurrent mark sweep GC freed 83(3KB) AllocSpace objects, 1(16KB) LOS objects, 15% free, 85MB/101MB, paused 624us total 31.157ms
I/art     ( 6852): Alloc concurrent mark sweep GC freed 9(12KB) AllocSpace objects, 0(0B) LOS objects, 15% free, 85MB/101MB, paused 702us total 34.198ms
I/art     ( 6852): Forcing collection of SoftReferences for 60MB allocation
I/art     ( 6852): Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 15% free, 85MB/101MB, paused 627us total 48.621ms
E/art     ( 6852): Throwing OutOfMemoryError "Failed to allocate a 63489036 byte allocation with 16777216 free bytes and 42MB until OOM"
W/System.err( 6852): java.lang.OutOfMemoryError: Failed to allocate a 63489036 byte allocation with 16777216 free bytes and 42MB until OOM
W/System.err( 6852): 	at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
W/System.err( 6852): 	at android.graphics.Bitmap.nativeCreate(Native Method)
W/System.err( 6852): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:939)
W/System.err( 6852): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:912)
W/System.err( 6852): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:843)
W/System.err( 6852): 	at com.fusetools.camera.Image.rotateImage(Image.java:68)
W/System.err( 6852): 	at com.fusetools.camera.Image.correctOrientationFromExif(Image.java:96)
W/System.err( 6852): 	at com.foreign.Fuse.Camera.TakePictureCallback.HandleIntent354(TakePictureCallback.java:38)
W/System.err( 6852): 	at com.Bindings.ExternedBlockHost.HandleIntent354(ExternedBlockHost.java:1656)
W/System.err( 6852): 	at com.Bindings.ExternedBlockHost.callUno_Android_ActivityUtils_OnReceived68(Native Method)
W/System.err( 6852): 	at com.foreign.Android.ActivityUtils$1.onResult(ActivityUtils.java:39)
W/System.err( 6852): 	at com.fuse.Activity._onActivityResult(Activity.java:54)
W/System.err( 6852): 	at com.fuse.App.onActivityResult(App.java:198)
W/System.err( 6852): 	at mx.qmarketing.futuromexico.MainActivity.onActivityResult(MainActivity.java:76)
W/System.err( 6852): 	at android.app.Activity.dispatchActivityResult(Activity.java:6475)
W/System.err( 6852): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3970)
W/System.err( 6852): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4017)
W/System.err( 6852): 	at android.app.ActivityThread.access$1400(ActivityThread.java:172)
W/System.err( 6852): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1471)
W/System.err( 6852): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 6852): 	at android.os.Looper.loop(Looper.java:145)
W/System.err( 6852): 	at android.app.ActivityThread.main(ActivityThread.java:5832)
W/System.err( 6852): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 6852): 	at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err( 6852): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err( 6852): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
D/MainActivity( 6852): Uno.Exception: java.lang.OutOfMemoryError: Failed to allocate a 63489036 byte allocation with 16777216 free bytes and 42MB until OOM
D/MainActivity( 6852):    at Android.Base.JNI.TryGetException(Android.Base.Primitives.JNIEnvPtr,[string])
D/MainActivity( 6852):    at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr,[string])
D/MainActivity( 6852):    at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr)
D/MainActivity( 6852):    at Fuse.Camera.TakePictureCallback.OnActivityResult(int,Java.Object,object)
D/MainActivity( 6852):    at Android.ActivityUtils.OnReceived(int,int,Java.Object)
W/System.err( 6852): java.lang.RuntimeException: Uno.Exception: java.lang.OutOfMemoryError: Failed to allocate a 63489036 byte allocation with 16777216 free bytes and 42MB until OOM
W/System.err( 6852):    at Android.Base.JNI.TryGetException(Android.Base.Primitives.JNIEnvPtr,[string])
W/System.err( 6852):    at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr,[string])
W/System.err( 6852):    at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr)
W/System.err( 6852):    at Fuse.Camera.TakePictureCallback.OnActivityResult(int,Java.Object,object)
W/System.err( 6852):    at Android.ActivityUtils.OnReceived(int,int,Java.Object)
W/System.err( 6852): 	at com.Bindings.ExternedBlockHost.callUno_Android_ActivityUtils_OnReceived68(Native Method)
W/System.err( 6852): 	at com.foreign.Android.ActivityUtils$1.onResult(ActivityUtils.java:39)
W/System.err( 6852): 	at com.fuse.Activity._onActivityResult(Activity.java:54)
W/System.err( 6852): 	at com.fuse.App.onActivityResult(App.java:198)
W/System.err( 6852): 	at mx.qmarketing.futuromexico.MainActivity.onActivityResult(MainActivity.java:76)
W/System.err( 6852): 	at android.app.Activity.dispatchActivityResult(Activity.java:6475)
W/System.err( 6852): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3970)
W/System.err( 6852): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4017)
W/System.err( 6852): 	at android.app.ActivityThread.access$1400(ActivityThread.java:172)
W/System.err( 6852): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1471)
W/System.err( 6852): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 6852): 	at android.os.Looper.loop(Looper.java:145)
W/System.err( 6852): 	at android.app.ActivityThread.main(ActivityThread.java:5832)
W/System.err( 6852): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 6852): 	at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err( 6852): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
W/System.err( 6852): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
F/libc    ( 6852): Fatal signal 6 (SIGABRT), code -6 in tid 6852 (ng.futuromexico)

Yeah, that’s certainly far too large, based on what I’ve seen before.

My personal experience tells that you’re generally safe when staying under 3000 pixels for both dimensions. That should be good enough for most applications.

Agree, in fact I’m using Camera.takePicture(1080, 1080) to reduce the size. The problem is that Picture size: (16M) 5312x2988 is the user-level camera settings.

I found a previously raised ticket for this and linked it to this post. The priority on that is probably low, but when any improvements are made this thread will be notified.

Thanks for you replys.
I will run some tests and see if I get any new information. For now I only have access to the 6.0 phone. When I get the other devices again I will check the console log.