Skip to main content

r/HTML


HTML to APK – Storage/Persistence Issue
HTML to APK – Storage/Persistence Issue

Hello everyone,

I have created an Android APK using an HTML-based quiz application.

The APK allows me to import HTML quiz files, and the imported files/data work perfectly while the app is open. However, there is a problem with data persistence.

Whenever I close/exit the APK and open it again, all the previously imported HTML files and saved quiz data are cleared/reset. It seems that the data is being stored only temporarily (possibly in cache/session storage) instead of persistent device storage.

I want the app to work like this:

Imported HTML files should be saved permanently on the device.

All imported quizzes/data should remain available after closing and reopening the APK.

Data should not be deleted when the app is exited or restarted.

The data should only be removed when the user explicitly chooses to delete it or uninstalls the app.

How can I fix this storage/persistence issue in an HTML-to-APK app?

Any guidance regarding localStorage, IndexedDB, WebView storage, or Android persistent storage would be appreciated.

Thank you.


Advertisement: Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.
Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.
  • Image
    Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.
  • Image
    Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.
  • Image
    Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.
  • Image
    Real talk from real sellers: Shopify is the easiest way to start. Now it's your turn. Start your free trial.


Proposal: A native HTML <unit> element for automatic unit conversion
Proposal: A native HTML <unit> element for automatic unit conversion

Browsers could automatically convert units to the user agent preferred unit. Just like the existing language declaration and browser can suggest auto translation.

<unit value="10" unit-base="m^2" unit-name="mi2" convert="auto">
  10 square miles
</unit>

The attributes mean:

  • value : numeric value

  • unit-name : standardized source unit (mi2, kg, mph, kW, etc.)

  • unit-base : standardized unit dimension (m2, kgm^2s-3)

  • convert : auto/on/off

The browser knows that mi2 is an area and can display the same quantity as, for example, 25.9 km² if that is the user's preferred unit.

The unit name and base are standardized and language neutral.

The important part is that the HTML stores the original value and unit. The UA only changes the presentation. And it's useful for weather app, cooking recipe website all the way to commercial airliner jet documentation.