Contacts API

  • 1
  • Question
  • Updated 8 years ago
I wish to access the contacts stored in the device, but unable to do with the sample documentation provided on phonegap.com.

I have tries it on iOS 6/5 and Android Jelly Bean without any success. I have even tried it with different Cordova versions 2.1 and 2.0

My requirement is as follows:
Need to save details of the message and the recipients of the message.

So two solutions for it.

1.) Make a replica of the composer, let the user select recipients as a result of Contacts API and key in the message then invoke the SMS Plugin provided.

This is of no success until I get the Contact API to work

2.) Read the result once the native Send button is pressed, but that does not return the result as the recipient details and Message which needs to be sent into my DB.

Kindly suggest a work around to achieve the functionality.
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
  • hopeful

Posted 8 years ago

  • 1
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
Hey Guys,

I was able to get it working on Android, but on IOS the issue still persists.

Any inputs....
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
Hello experts,

I hope this will be addressed in PGB 2.2.

I heard PGB 2.2 is expected this week.
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
With the arrival of PGB is the contacts issue resolved. Any heads up on the issue will definately be helpful.

I am trying the example from phone gap docs for contacts. Let me know if anything needs to be done differently

Look forward to a response
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi Nikhil

Are you built the app locally or using Build service?

-Amir
Photo of Joe Vescio

Joe Vescio

  • 83 Posts
  • 7 Reply Likes
I had the same problem just yesterday. iOS 6 requires permission before developers can save contacts to the address book. The solution which worked for me was to tell the online build website to use phonegap version to 2.2, via the tag:

preference name="phonegap-version" value="2.2.0"

to build the application. PGv2.2 has the fix required to save contacts to iOS 6 devices. Also, any local build will probably not report this error when launching the app to a device connected to xcode, at least in my case.

if you need more detail please see my recent post:

http://community.phonegap.com/nitobi/...
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
Hi Amir,

I got it to work on iOS while compiling locally.

Is there any way I can get it to work through PGB for Android and iOS. I am trying the Contact Find Options example given on the Phonegap Portal.

App Id 257185
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi Nikhil

Modify your index.html by removing cordova.js versioning number. It should work correctly after that.

from src="cordova-2.2.0.js" to just src="cordova.js"

There were a known issue about this. Find out here:
http://community.phonegap.com/nitobi/...

Cheers
-Amir
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
Thanks Amir, will check and keep you posted.
Photo of Nikhil

Nikhil

  • 21 Posts
  • 0 Reply Likes
Hi Amir,

Happy New year again!!!

Many thanks for your support. The issue got resolved, it was a silly bug at my end.

Phonegap Rocks!!!!