let me address my issue here.
i'm using an Intent
to grab an image from the camera file by passing a file along the Intent
to return it, however in my tests in the Samsung Galaxy S5, if the image was taken normally the image will return, but lets say if Samsung tries to handle low light and do its "so called hard working" the application will crash. i'v tried storing the fileName
in onSaveInstanceState
and retreiving it in onRestoreInstanceState
this prevent the application from crashing, but however it recreates my Activity
which below it there is another Activity
which has BroadcastReceiver
that is been destroyed along when the Activity
recreated, is there any workaround to tell Samsung to take the image without its crappy features to prevent this scenario from happening?
Edit
with test with only sending the Intent
without passing a Uri
file with it, it still if it handles low lights, the application will crash.

- 6,140
- 3
- 36
- 67
-
Will [this](http://stackoverflow.com/questions/15248265/camera-intent-not-working-with-samsung-galaxy-s3/15287164#15287164) help? – Skynet Jan 30 '15 at 11:25
-
@Skynet nope, it doesn't, the problem as i described that the image returns fine, only it crashes the App when Samsung tries to handle low lights. i'm trying to prevent this from recreating my Activity. – Kosh Jan 30 '15 at 11:32
-
Please post the manifest declaration of this particular activity. – Skynet Jan 30 '15 at 11:33
-
@Skynet `android:name=".activities.PhotoActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:screenOrientation="user"` – Kosh Jan 30 '15 at 11:35
-
Seems proper, can you use the [Debug](http://developer.android.com/tools/debugging/debugging-tracing.html) class to pin point where exactly does it crash? – Skynet Jan 30 '15 at 11:37
-
there is no such way you can tell what cause the application to crash, basically when it returns to the `onActivityResult` it crashes the application. for example, the file i passed along the intent returns null if the image taken with handling low light, even if i checked against the file or the uri, the application still going to recreate it due to cause of samsung return result – Kosh Jan 30 '15 at 11:40
-
Samsung my friend, is crazy! – Skynet Jan 30 '15 at 11:42
-
@Skynet tell me about it :) .. you have all of your application works on Samsung and then when you try to test it on different phone, boom. your application crashes. – Kosh Jan 30 '15 at 11:44
-
did you find a way to solve this? i think i am having the exact same issue, my app is recreated... i dont mind if the image is not available yet, i just want my app not to be recreated... – Ariel Capozzoli Aug 12 '15 at 14:07
-
Nope, no such way unless if u create an activity where it only handles the camera intent so instead of opening intent for camera u open the other activity which.opens the camera intent this will.result in that activity recreation not ur main activity. – Kosh Aug 13 '15 at 00:29
-
Having the same issue. this is the dumbest bug I have ever came across. :/ – arsena Mar 28 '17 at 08:28
1 Answers
While developing our Cordova app on Android on a Samsung S5, I've noticed the same issues – in regular mode, the Samsung camera app appears to use less memory, so the Android garbage collector doesn't kill our app. However, in the low-light mode you're describing, the Android garbage collector kills our app in the background.
The Cordova camera plugin doesn't support the Android lifecycle, so I've had to fork it, and store the imageUri (and some other settings) to a Preference in order to retrieve it again once the app restarts.
I think you'll need to put a Debug.waitForDebugger()
statement in your onActivityResult
method, so that when your app restarts you can connect the debugger and step through your code that processes the result. My guess is that you're referencing a variable that isn't available because of the loss of state.

- 1,970
- 1
- 12
- 7