Kosh
Kosh

Reputation: 6334

Samsung Camera Intent

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.

Upvotes: 3

Views: 1030

Answers (1)

jfrumar
jfrumar

Reputation: 1980

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.

Upvotes: 1

Related Questions