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
New Developer
maiakhoa
Posts: 10
Registered: ‎08-08-2013
My Device: Z10

ContactService can not get full contacts from device

[ Edited ]

Hi all,

 

Please help me solve this problem, I used ContactService and it's working fine but it can not get all contacts from my device even I don't set any criteria like below, it just got a part of contacts.

 

QList<Contact> contacts;

    if (m_filter.isEmpty()) {
        ContactListFilters filter;
        contacts = m_contactService->contacts(filter);
    } else {
        ContactSearchFilters filter;
        filter.setSearchValue(m_filter);
        contacts = m_contactService->searchContacts(filter);
    }

 

 

Please use plain text.
Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: ContactService can not get full contacts from device

Have you tried it on emulator. 

Please use plain text.
New Developer
maiakhoa
Posts: 10
Registered: ‎08-08-2013
My Device: Z10

Re: ContactService can not get full contacts from device

I tested on real device (Z10). Please help me with this one

Please use plain text.
Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: ContactService can not get full contacts from device

Is it dev apha?

Please use plain text.
New Developer
maiakhoa
Posts: 10
Registered: ‎08-08-2013
My Device: Z10

Re: ContactService can not get full contacts from device

I'm using blackberry z10. This is the device "http://us.blackberry.com/smartphones/blackberry-z10.html". I tried another app and it get fullly my contacts.

Please use plain text.
Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: ContactService can not get full contacts from device

Can you provide the full source code, with all the parameters 

Please use plain text.
New Developer
maiakhoa
Posts: 10
Registered: ‎08-08-2013
My Device: Z10

Re: ContactService can not get full contacts from device

I'm using addressbook source of the Cascades Sample

 

https://github.com/blackberry/Cascades-Samples/tree/master/addressbook

Please use plain text.
Developer
Bluenoser
Posts: 276
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: ContactService can not get full contacts from device

[ Edited ]

It looks like there is a default filter ot 20 records.

 

I changed this to

 

    if (m_filter.isEmpty()) {
        // No filter has been specified, so just list all contacts
        ContactListFilters filter;
        filter.setLimit(50);
        contacts = m_contactService->contacts(filter);
    } else {
        // Use the entered filter string as search value
        ContactSearchFilters filter;
        filter.setSearchValue(m_filter);
        contacts = m_contactService->searchContacts(filter);
    }

 And it displayed more records.

Please use plain text.
New Developer
maiakhoa
Posts: 10
Registered: ‎08-08-2013
My Device: Z10

Re: ContactService can not get full contacts from device

Thanks very much, it solved the problem.

Please use plain text.
Developer
Bluenoser
Posts: 276
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: ContactService can not get full contacts from device

You are welcome, if you use filter.setLimit(0); , then it will get all records.

Please use plain text.