I am using the following code to store the ParseObject with a ParseFile. I have enabled Parse local datastore in Application subclass. This code storing an instance of the ParseObject in local datastore and in the parse server when the application in connected to the internet.
final ParseFile file = new ParseFile(position + ".mp4", data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
ParseObject po = new ParseObject("Recordings");
po.put("code", position);
po.put("name", myname);
po.put("file", file);
po.saveEventually();
}
});
Same code when the app is not connected to internet is throwing the following Exception. java.lang.IllegalStateException: Unable to encode an unsaved ParseFile. And the app is crashing. Object is not stored in local datastore.
So how can I store a ParseObject with a ParseFile in parse local datastore when there is no internet?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…