You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Alf Stockton <al...@stockton.co.za> on 2013/05/21 15:52:41 UTC

Retrieve cell phone number

Based on the API at phonegap I have put together the following HTML in a 
test to see if I can retrieve the cellphone number when I browse to this 
html from my cell phone. I have obviously misunderstood something for I 
would expect to see the cellnumber in the cellnumber field on the form 
but no such luck.
I would be grateful for any helpful suggestions.

<!DOCTYPE html>
<html>
   <head>
     <title>Contact Example</title>

     <script type="text/javascript" charset="utf-8" 
src="cordova-2.7.0.js"></script>
     <script type="text/javascript" charset="utf-8">

     // Wait for Cordova to load
     //
         function onDeviceReady() {
         var myContact = navigator.contacts.create({"displayName": "Test 
User"});
         document.cellnumber = new ContactField('mobile', 
myContact.cellPhone, true);
     }


     </script>
   </head>
   <body>
     <h1>Example</h1>
     <p>Create Contact</p>
<input id="cellnumber" name="cellnumber" >
   </body>
</html>

-- 
Regards,
Alf Stockton                 www.stockton.co.za
Everything will be all right in the end... if it's not all right then it's not yet the end.


Re: Retrieve cell phone number

Posted by Shazron <sh...@gmail.com>.
Hi Alf,
This is a list for discussing development of Cordova itself. The list for
discussing using Cordova is:
https://groups.google.com/forum/?fromgroups#!forum/phonegap

The docs should have great examples of how to use Contacts:
http://cordova.apache.org/docs/en/2.7.0/cordova_contacts_contacts.md.html#Contacts


On Tue, May 21, 2013 at 6:52 AM, Alf Stockton <al...@stockton.co.za> wrote:

> Based on the API at phonegap I have put together the following HTML in a
> test to see if I can retrieve the cellphone number when I browse to this
> html from my cell phone. I have obviously misunderstood something for I
> would expect to see the cellnumber in the cellnumber field on the form but
> no such luck.
> I would be grateful for any helpful suggestions.
>
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>Contact Example</title>
>
>     <script type="text/javascript" charset="utf-8"
> src="cordova-2.7.0.js"></**script>
>     <script type="text/javascript" charset="utf-8">
>
>     // Wait for Cordova to load
>     //
>         function onDeviceReady() {
>         var myContact = navigator.contacts.create({"**displayName": "Test
> User"});
>         document.cellnumber = new ContactField('mobile',
> myContact.cellPhone, true);
>     }
>
>
>     </script>
>   </head>
>   <body>
>     <h1>Example</h1>
>     <p>Create Contact</p>
> <input id="cellnumber" name="cellnumber" >
>   </body>
> </html>
>
> --
> Regards,
> Alf Stockton                 www.stockton.co.za
> Everything will be all right in the end... if it's not all right then it's
> not yet the end.
>
>