cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <>
Subject Re: [Android] Refactoring in CordovaActivity
Date Thu, 29 Nov 2012 00:34:08 GMT

Yes, the camera is still an issue.  There are two approaches to
getting around this issue.  One of which is to allow users to restore
the state that we save for them.  I've added this ability in Cordova
for the most part, but the problem with the tests is that I never had
a problem with my camera crashing.  The other is to use a camera

The code to restore state can't actually go into DroidGap in this
release because we have way too many methods that we have to preserve
for some reason or another.  We desperately need to refactor DroidGap
and decide what should be supported and what should go away, and I
think that should be a big part of 2.4.0.

What this code does is allow for this to be done in the activity
that's being extended:

public class cordovaExample extends DroidGap

    public void onCreate(Bundle savedInstanceState)
        super.setBooleanProperty("keepRunning", false);


        if(savedInstanceState != null)
            Log.d("Test Application", "Restoring the state");

    protected void onSaveInstanceState(Bundle outState)

It's not an insane amount of code, and since people are already
hacking the Java classes anyway, it'd be good to give some people some
tools to get around this problem.  It's open source, and people
already have the ability to shoot their faces off, so I'm not
concerned about them shooting their feet.

On Wed, Nov 28, 2012 at 4:22 PM, Lorin Beer <> wrote:
> Hey Joe,
> is the Camera still an issue for state restoration?  What are the
> limitations of using this feature?
> I think the ability to restore state is awesome to have, and would be
> appreciated, but depending on the limitations I'm concerned this would be
> like handing users a loaded gun that only points at feet.
> - Lorin
> On Wed, Nov 28, 2012 at 3:48 PM, Joe Bowser <> wrote:
>> Hey
>> A while ago I did an experiment where I allowed users to restore their
>> state in the case that Cordova  gets killed.  This seemed like a good
>> idea except that I couldn't test it because the Camera requires that
>> you have background processes running.  That being said, I think that
>> the code is an improvement and should be put into the next release,
>> namely so we can throw our users a bone if they want to try restoring
>> state themselves.
>> Here's the branch here:
>> What do people think?
>> Joe

View raw message