Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 14
Registered: ‎10-04-2010
My Device: Not Specified

Getting contact details after closing contact edit card

[ Edited ]

I'm trying to get the details of an existing contact after it's been edited using the card sys.pim.contacts.card.composer with the action bb.action.EDIT. When I try to retrieve the card details using ContactService().contactDetails(contactId) immediately after the card return, the details are missing. If I put in a QTimer to insert an arbitrary 2 second delay, then the edited contact details are in the object as they should be.

 

As a fallback, I tried connecting to the contactsChanged() signal emitted from the ContactService, I properly receive the ids of changed contacts, but when I retrieve them, I have the same problem where the contact details are empty unless i insert a delay.

 

Inserting a 2 second delay works, but it slows my app more than necessary, seems arbitrary and like it's going to get me into trouble when the device gets busy. Is there a different signal i should be connecting to, or some more deterministic way to get the data after it's been properly committed?

 

Any ideas? Is there something I can do to make sure the contact change is committed before I retrieve it?

 

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Getting contact details after closing contact edit card

Relying on the card finished is not a good idea but contactsChanged() should be reliable. Can you log a bug against the contactsChanged() being fired early and share the link here? Please include a sample app to reproduce if possible. I will escalate it from there. 

Contributor
Posts: 14
Registered: ‎10-04-2010
My Device: Not Specified

Re: Getting contact details after closing contact edit card

thanks, shadid!  I'll do that.  Yeah, I wasn't entirely surprised that closing the card wasn't sufficient (tho I was hoping the details might be returned in the card done message), I was more surprised about the contactsChanged() situation.  Thanks for confirming I wasn't missing anything.  I'll copy it into a sample app, and if that still fails log a bug with it attached.