i'm just checking the functionality of each API.. here's my code

Index.html:
-------------

<html>
        <head>
                <link rel="stylesheet" type="text/css" href="css/css.css"/>
                <script type="text/javascript" 
src="js/jquery_1.7_min.js"></script>
                <script type="text/javascript" src="js/main.js"></script>
        </head>
        
        <body>
                <input type = "button" id = "button" value = "click me"/>
        </body>
</html>



main.js :
--------


                        
        $('#button').live('click', hello);
        
          function hello() {
                var person = new mozContact();
                person.givenName  = ["John"];
                person.familyName = ["Doe"];
                person.nickName   = ["No kidding"];
                var saving = navigator.mozContacts.save(person);
                saving.onsuccess = function() {
                 alert('new contact saved');
                  person = saving.result;
                };

                saving.onerror = function(err) {
                  alert(""+err);
                };
        }  


manifest.webapp :
-----------------


{
        "version": "0.1",
        "name": "Contacts API",
        "description": "Nothing",
        "launch_path": "/index.html",
        "type": "privileged",
        "icons": {
                 "16": "/img/icons/mortar-16.png",
                "48": "/img/icons/mortar-48.png",
                "128": "/img/icons/mortar-128.png"
        },
        "developer": {
                "name": "Rishi"
        },
        "permissions": {
                "contacts": {
                 "description": "Required for autocompletion in the share 
screen",
                 "access": "readwrite"
                }
    },
        "default_locale": "en"
}

thats it.. thank you
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to