From fd8bb2f671d059cd80b8071e42510fd7385b8fe5 Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 29 Apr 2011 02:06:58 +0800 Subject: [PATCH] Issue 72: Contact.Save: onSuccess callback is called when contact is not saved. --- framework/src/com/phonegap/ContactManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/src/com/phonegap/ContactManager.java b/framework/src/com/phonegap/ContactManager.java index 5a79c37a..7ef70c18 100755 --- a/framework/src/com/phonegap/ContactManager.java +++ b/framework/src/com/phonegap/ContactManager.java @@ -46,7 +46,14 @@ public class ContactManager extends Plugin { return new PluginResult(status, res, "navigator.service.contacts.cast"); } else if (action.equals("save")) { - return new PluginResult(status, contactAccessor.save(args.getJSONObject(0))); + if (contactAccessor.save(args.getJSONObject(0))) { + return new PluginResult(status, result); + } + else { + JSONObject r = new JSONObject(); + r.put("code", 0); + return new PluginResult(PluginResult.Status.ERROR, r); + } } else if (action.equals("remove")) { if (contactAccessor.remove(args.getString(0))) {