Unable to list all contacts on LG phone

RandomCoder

Well-Known Member
Licensed User
Longtime User
Hi Erel,

Thanks for the reply.
I'll contact LG to see if a firmware update will be available in the near future.

Kind regards,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
A little bit more info....

Hi again Erel,

I've made sure that the phone is running the latest firmware and contacted LG support for assistance. But in the meantime I've been trying various things to see if I could access any of the phones contacts, e.g. saving the conatcts to the SIM and to the SD card.

Over the last couple of nights I've been searching the web for a solution and found that the Android SDK comes with samples, one of which is called ContactManager. After a lot of frustration getting to grips with Eclipse (it's no where near as simple as B4A), I've finally managed to get the sample onto the phone so as to test if any contacts are listed and I can report that they do show up correctly.

Below is the section of code that actually gets the contacts list...
B4X:
    private Cursor getContacts()
    {
        // Run query
        Uri uri = ContactsContract.Contacts.CONTENT_URI;
        String[] projection = new String[] {
                ContactsContract.Contacts._ID,
                ContactsContract.Contacts.DISPLAY_NAME
        };
        String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" +
                (mShowInvisible ? "0" : "1") + "'";
        String[] selectionArgs = null;
        String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

        return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
    }

The contacts are only listed if mShowInvisible is False (Selecting the "show invisible contacts only" causes the contacts to disappear).

With this information is there anything that you might be able to do to help me list all contacts using B4Android?

Please help,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
This is good. I plan to add support for the newer contacts API.

Fantastic news, I'm glad to have been of some use ;)
Will this also allow us to add contacts using the same library, or will miscUtil still be needed for that?

Thanks,
RandomCoder
 

peacemaker

Expert
Licensed User
Longtime User
So, if such extra condition exists: mShowInvisible is False,
now PhoneContacts.GetAll works buggy: it cannot get_them_all, as declared.
Erel, i guess, the lib needs to be fixed\updated ASAP :)
 

peacemaker

Expert
Licensed User
Longtime User
Yes ! Thank you very much.
It works. But really - be aware - getting about 250 contacts it's more than 10 seconds. :-(
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Problem RESOLVED!

Nearly missed this new update (forgot to subscribe to it :BangHead:)
I can confirm that all contacts are listed correctly using Contacts2 in the new phone library.
Thanks for the great support Erel, excellent work :sign0188:

Regards,
RandomCoder
 
Top