You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2013/04/22 21:45:15 UTC

[jira] [Resolved] (CB-3064) The preferences are read only the very first time the application runs

     [ https://issues.apache.org/jira/browse/CB-3064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bowser resolved CB-3064.
----------------------------

    Resolution: Not A Problem

If you leave an app in Android, it isn't stopped, it is paused.  So, for example, if you go off and do something like play Ingress, and then come back, the application will restore its state and move on.  When the activity restores its state, it loads the data from the intent where the Config class stores the data read from config.xml.

In the config.xml file, I put the following as the errorUrl:
    <preference name="errorUrl" value="file:///android_asset/www/ohnoes.html" />

Then in DroidGap.java, I added this code in onResume:
//Code to test CB-3064
        String errorUrl = this.getStringProperty("errorUrl", null);
        LOG.d(TAG, "CB-3064: The errorUrl is " + errorUrl);

If we lose this data, this should not say ohnoes.html.  However, it appears that it does.  As long as we have the state of the intent, we should have the data.  If the application is killed, it has to go back through the initial init process.

This was tested on Android 4.2.2 (Nexus 7) , Android 4.1.x (Samsung Galaxy S3) and Android 2.3.6 (Nexus S).  If your device is a special case, please let us know and we can re-open this issue.


                
> The preferences are read only the very first time the application runs 
> -----------------------------------------------------------------------
>
>                 Key: CB-3064
>                 URL: https://issues.apache.org/jira/browse/CB-3064
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.5.0, 2.6.0
>         Environment: All Android versions and devices
>            Reporter: Davide Maestroni
>            Assignee: Joe Bowser
>
> The preferences in the config.xml file are not read again if application exits and then restarts.
> A simple test is to set the background color to GREEN (-16711936 or [0xff00ff00]) and use an html page with transparent background. 
> The first time it is run, the application correctly displays a green background but then, after exiting by pressing the back or home button, and re-running it, the background stays black.
> Forcing the application thread to stop from the Android settings menu seems to cause the preferences file to be read again.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira