Skip to content

Instantly share code, notes, and snippets.

@rik
Forked from anonymous/default.txt
Last active December 18, 2015 02:09
Show Gist options
  • Save rik/5708877 to your computer and use it in GitHub Desktop.
Save rik/5708877 to your computer and use it in GitHub Desktop.
You'll need to do reset-gaia to give the template app the good permissions (or edit permissions.sqlite).
test_apps/template/index.html | 16 ++++++++++++++++
test_apps/template/manifest.webapp | 6 +++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/test_apps/template/index.html b/test_apps/template/index.html
index 4611ccd..baca876 100644
--- a/test_apps/template/index.html
+++ b/test_apps/template/index.html
@@ -16,6 +16,22 @@
</style>
<script>
+ var mContact = {'familyName': 'Prout'};
+ mContact.tel = [
+ {'value': '+33 6 99 99 99 99'}
+ ];
+
+ var contact = new mozContact();
+ contact.init(mContact);
+ var saving = navigator.mozContacts.save(contact);
+
+ saving.onsuccess = function() {
+ console.log( 'yahoo!');
+ };
+
+ saving.onerror = function() {
+ console.log( 'boo :(');
+ }
</script>
</head>
diff --git a/test_apps/template/manifest.webapp b/test_apps/template/manifest.webapp
index 69119ac..958886c 100644
--- a/test_apps/template/manifest.webapp
+++ b/test_apps/template/manifest.webapp
@@ -55,5 +55,9 @@
"default_locale": "en-US",
"icons": {
"128": "/style/icons/Blank.png"
+ },
+ "type": "certified",
+ "permissions": {
+ "contacts":{ "access": "readwrite" }
}
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment