[Interest] Random problems with QSettings on Android

Edward Sutton edward.sutton at subsite.com
Wed May 27 15:15:54 CEST 2015


>Does anyone here had problems with QSettings persistence on Android device?
>I’m having random and occasional reports from users on Android telling me that settings don’t persist.

I have not seen *random* issues with QSettings on Android.

I have seen issues with users swiping the app and closing it that did not give my widget app a chance to save settings.

Adding the following solved the problem by giving me chance to save settings:


#ifdef PLATFORM_ANDROID

/// Use signal QGuiApplication::applicationStateChanged(Qt::ApplicationState state)

/// to catch Android and hopefull iOS users pressing the home or multi-task button.

/// Under Android, users can press rectangular multi-task button,

/// this will change state to Qt:ApplicationInactive.

///

/// When exiting Qt::ApplicationActive state, save settings.

///

/// Is there any reason to disable this for desktop platforms?

void MainWindow::applicationStateChanged(Qt::ApplicationState state)

{

    qDebug("Qt::ApplicationState %i", state);

    static Qt::ApplicationState oldState = Qt::ApplicationSuspended;

    if(oldState == state)

    {

        return;

    }

    oldState = state;

    if(Qt::ApplicationActive == state )

    {


        // Fix attempt for Android half-portrait-screen on start-up

        // Issue is reproducible on Sansung S4

        // Bug 468 - [Android] App window size not full-screen on first open

        // http://subsitedesign/bugzilla/show_bug.cgi?id=468

        showMaximized();


        return;

    }

    // This uses QSettings underneath

    Settings::write(Settings::settings(), this);

}

#endif




On May 26, 2015, at 5:37 AM, Imaginando <info at imaginando.pt<mailto:info at imaginando.pt>> wrote:

Hi,

Does anyone here had problems with QSettings persistence on Android device?

I’m having random and occasional reports from users on Android telling me that settings don’t persist.

Thanks,

Regards,

Nuno

_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150527/62426f82/attachment.html>


More information about the Interest mailing list