Can I get contacts from my Skype account in Android?

I implemented Skype functions for video / audio calls, using Intent in my application, it works fine. But now I want to get all the contacts from my Skype account, is this possible ?.

Is there an alternative way to show my Skype account contact list, please give at least some idea?

+6
source share
1 answer

All contacts (if synchronized) can be requested using ContactsContract . The RawContacts.ACCOUNT_TYPE column of the RawContacts.ACCOUNT_TYPE table indicates the type of account for each record ("raw" means that it contains all the records, for example, several rows for one person with several aggregated contacts).

To read Skype contacts, you can do something like this:

 Cursor c = getContentResolver().query( RawContacts.CONTENT_URI, new String[] { RawContacts.CONTACT_ID, RawContacts.DISPLAY_NAME_PRIMARY }, RawContacts.ACCOUNT_TYPE + "= ?", new String[] { "com.skype.contacts.sync" }, null); int contactNameColumn = c.getColumnIndex(RawContacts.DISPLAY_NAME_PRIMARY); ArrayList<String> mySkypeContacts = new ArrayList<String>(); while (c.moveToNext()) { /// You can also read RawContacts.CONTACT_ID to query the // ContactsContract.Contacts table or any of the other related ones. mySkypeContacts.add(c.getString(contactNameColumn)); } 

Be sure to request permission android.permission.READ_CONTACTS in the AndroidManifest.xml file.

+3
source

All Articles