Sana Joseph
Sana Joseph

Reputation: 1948

How can I save data on Mobile using Phonegap

I'm working on a To-do list for Mobile using phone gap. I use sqlite to save the data, but when I close the simulator & reopen it, the data is lost, so I'm wondering if it won't be lost when I put it on a real mobile, & is there a way to check the mobile database from the mobile itself.

Upvotes: 1

Views: 877

Answers (2)

Fergus In London
Fergus In London

Reputation: 1203

Just to clarify - this actually depends upon which platform you're developing for; and whether the SDK provides a "simulator" or an "emulator".

Example: Android Emulator - This is an emulator which means it emulates the device as a real device; like a virtual computer it's capable of saving it's data and state. The Android emulator is built upon QEMU - an emulation package akin to a simplistic version of VMWare. This is one reason why starting the Android Emulator is akin to starting an Android device with regards to how long it takes: it actually takes a while for Android to load, initialise and so on.

In contrast to the iPhone Simulator - this is just a simluator of what the device would do; it doesn't actually run iOS it just simulates the app running in such an environment. Hence it isn't capable of saving data, even if it is very fast in comparison with the Android Emulator.

This might not seem a big point - but in a production environment it really can be. If you're testing an application across multiple platforms then these differences can look as though the implementation for one platform can't save data; which ultimately leads to hours of debugging and reading just to find out it's to do with the SDK tools - not your code!

Upvotes: 0

thelinh bui
thelinh bui

Reputation: 226

Yes absolutely, when you close the simulator your database will remove (when u run the simulator from start, it will assume the application is a fresh one). If you want to check if your data is remain within the mobile when the application is closed. Press the home button and go back again.

Upvotes: 1

Related Questions