privateson
privateson

Reputation: 387

Store Data locally only Using Parse

Can I store Data locally only (never want to save it on server) using Parse local database? The reason we want to use parse to do this is that the same code(logic) can be easily used in IOS, Android and other places. Thanks

Upvotes: 0

Views: 322

Answers (3)

Sunny Shah
Sunny Shah

Reputation: 13020

You should use only pinInBackground. it will save only locally to the parse.

Upvotes: 1

Matt
Matt

Reputation: 3190

As long as you keep your ParseObjects pinned, you can use them offline indefinitely.

See Parse's release announcements for the Local Datastore. Links to the guide and API are located at the bottom of the respective page: Android | iOS

Upvotes: 2

Matt Boyle
Matt Boyle

Reputation: 385

I'm not familiar with parse, but if it has a local database then you certainly should be able to.

Alternatively, save it to file:

String filename = "myfile";
String string = "Hello world!";
FileOutputStream outputStream;

try {
  outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
  outputStream.write(string.getBytes());
  outputStream.close();
} catch (Exception e) {
  e.printStackTrace();
}

save it an SQLite database ( I recommend using sugar, it makes it trivial).

https://satyan.github.io/sugar/

or if you only need it for the time the app is open, Use a Bundle.

Upvotes: 0

Related Questions