Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android (and iOS) Local Storage Disappearing
Forum Updated to NodeBB v4.3 + New Features

Android (and iOS) Local Storage Disappearing

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 4 Posters 1.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PSI_lbc
    wrote on last edited by
    #1

    Android Customers reported that when updating from V1.1 to V1.2 that the Google update process wiped their device local storage.

    V1.1 was built with Qt version 5.8. V1.2 was built from Qt version Qt 5.10.1 (Clang 8.0 (Apple), 64 bit)

    It is my understanding that the device local storage is to remain intact from one version to another. The only thing to erase device local storage is an uninstall..either the Play Store Uninstall or the Android App Setting Uninstall/Clear Storage.

    https://developer.android.com/guide/topics/data/data-storage

    In researching..
    https://stackoverflow.com/questions/7750857/how-permanent-is-local-storage-on-android-and-ios

    “localStorage can be wiped out by the OS (android,ios) at any time. This is really serious if you care about data persistence.”

    There appears to be a conflict with what the Android and iOS documentation says and what developers are reporting. Which is correct?

    Some of my customers replied to my e-mail queries regarding this issue and admitted they did, in fact, uninstall their app. Other customers adamantly claimed the only thing they did was update to the new version. Releasing V1.2 caused a shitstorm of negative reviews. It forced me to make refunds to unhappy customers. There is no way to reply or explain a negative review in just 350 characters.

    I would like to NOT go through this each time a new release is made.

    I can see how a package name change could cause issues with local storage, the app package name in the Android manifest file did not change from V1.1 to V1.2.

    What am I missing on the local storage issue?

    If iOS randomly reclaims app local storage, then using it for things you expect to be there until uninstalled makes absolutely zero sense. If Android now does this too, the same goes for local storage on Android devices.

    What are people doing to avoid this obvious pitfall / limitation? Use SD card storage on Android? What if the Android device has no SD card or the API/OS level does not support installing the app to the SD card? Android 8.0 on allows this with the correct Manifest File Setting..but there does not appear to be something accessible to modify in Qt Creator. What do you do on iOS?

    ekkescornerE 1 Reply Last reply
    1
    • P PSI_lbc

      Android Customers reported that when updating from V1.1 to V1.2 that the Google update process wiped their device local storage.

      V1.1 was built with Qt version 5.8. V1.2 was built from Qt version Qt 5.10.1 (Clang 8.0 (Apple), 64 bit)

      It is my understanding that the device local storage is to remain intact from one version to another. The only thing to erase device local storage is an uninstall..either the Play Store Uninstall or the Android App Setting Uninstall/Clear Storage.

      https://developer.android.com/guide/topics/data/data-storage

      In researching..
      https://stackoverflow.com/questions/7750857/how-permanent-is-local-storage-on-android-and-ios

      “localStorage can be wiped out by the OS (android,ios) at any time. This is really serious if you care about data persistence.”

      There appears to be a conflict with what the Android and iOS documentation says and what developers are reporting. Which is correct?

      Some of my customers replied to my e-mail queries regarding this issue and admitted they did, in fact, uninstall their app. Other customers adamantly claimed the only thing they did was update to the new version. Releasing V1.2 caused a shitstorm of negative reviews. It forced me to make refunds to unhappy customers. There is no way to reply or explain a negative review in just 350 characters.

      I would like to NOT go through this each time a new release is made.

      I can see how a package name change could cause issues with local storage, the app package name in the Android manifest file did not change from V1.1 to V1.2.

      What am I missing on the local storage issue?

      If iOS randomly reclaims app local storage, then using it for things you expect to be there until uninstalled makes absolutely zero sense. If Android now does this too, the same goes for local storage on Android devices.

      What are people doing to avoid this obvious pitfall / limitation? Use SD card storage on Android? What if the Android device has no SD card or the API/OS level does not support installing the app to the SD card? Android 8.0 on allows this with the correct Manifest File Setting..but there does not appear to be something accessible to modify in Qt Creator. What do you do on iOS?

      ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on last edited by
      #2

      @PSI_lbc I'm always storing my app data here:

      // Android: AppDataLocation works out of the box, iOS you must create the DIR first !!
          mDataRoot = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).value(0);
          mDataPath = mDataRoot+"/data/";
      

      never had any problems of missing data after updating the app

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.9 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      1 Reply Last reply
      2
      • P Offline
        P Offline
        PSI_lbc
        wrote on last edited by
        #3

        @ekkescorner said in Android (and iOS) Local Storage Disappearing:

        Thanks for the reply. Your code generates this..

        QString mDataRoot = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).value(0);
        QString mDataPath = mDataRoot+"/data/";
        qDebug() << mDataPath ;
        
        Output:  "/data/data/com.company.app.name/files/data/"
        

        I'm already using something similar..

        QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
        qDebug() <<  dataPath ;
        
        Output:  "/data/data/com.company.app.name/files"
        
        

        ..a closing "/" is added later to the path.

        For iOS, output for your way is..

        "/var/mobile/Containers/Data/Application/longapp#?/Library/Application Support/CompanyName/AppName/data/"
        
        

        And I'm using this..

        QString docsPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
        qDebug() <<  docsPath ;
        
        Output: "/var/mobile/Containers/Data/Application/longapp#?/Documents"
        

        ..a closing "/" is added later to the path.

        Not sure if your way would be better fo iOS. I don't remember why I decided to use the different standard documents path for my iOS app versus the standard data path.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GBergamo
          wrote on last edited by
          #4

          Hi,

          This happened also to my app after an app update but only on iOS.
          Many customers started to write negative reviews because they lost their settings.
          I've published this app 5 years ago and I've done lots of updates but this is the first time I've this big issue.

          Settings are stored in the path returned by:
          QStandardPaths::writableLocation(QStandardPaths::DataLocation)

          I've done some tests by installing the old app version using xcode and the updating it (always from xcode) but I'm not able to reproduce it.

          The only "ios level" big thing I've modified is the support of push notifications, so I've added them to the app entitlements.
          Could that be the problem?

          jsulmJ 1 Reply Last reply
          0
          • G GBergamo

            Hi,

            This happened also to my app after an app update but only on iOS.
            Many customers started to write negative reviews because they lost their settings.
            I've published this app 5 years ago and I've done lots of updates but this is the first time I've this big issue.

            Settings are stored in the path returned by:
            QStandardPaths::writableLocation(QStandardPaths::DataLocation)

            I've done some tests by installing the old app version using xcode and the updating it (always from xcode) but I'm not able to reproduce it.

            The only "ios level" big thing I've modified is the support of push notifications, so I've added them to the app entitlements.
            Could that be the problem?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @GBergamo said in Android (and iOS) Local Storage Disappearing:

            Settings are stored in the path returned by:
            QStandardPaths::writableLocation(QStandardPaths::DataLocation)

            You don't use https://doc.qt.io/qt-5/qsettings.html ?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • G Offline
              G Offline
              GBergamo
              wrote on last edited by
              #6

              I'm using qsettings as ini files in that folder. Moreover I'm also storing sqlite databases and json configurations files. All of them disappeared after the update.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved