问题
Context context = getApplicationContext();
AppContactService appContactService = new AppContactService(context);
if (!appContactService.isContactExists("bdhameliya1"))
{
List<Contact> contactList = new ArrayList<Contact>();
Contact contact = new Contact();
contact.setUserId("adarshk");
contact.setFullName("John");
contact.setImageURL("R.drawable.couple");
contactList.add(contact);
Contact contactRaj = new Contact();
contactRaj.setUserId("krunal");
contactRaj.setFullName("krunal");
contactRaj.setImageURL("https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p200x200/12049601_556630871166455_1647160929759032778_n.jpg?oh=7ab819fc614f202e144cecaad0eb696b&oe=56EBA555&__gda__=1457202000_85552414c5142830db00c1571cc50641");
contactRaj.setEmailId("krunal.kd@gmail.com");
contactList.add(contactRaj);
appContactService.addAll(contactList);
}
I tried out this way
my problem is when I used applozic SDK, default contact are list out, but I want my phonebook list and send message to that person
回答1:
Update library to 4.1
compile 'com.applozic.communication.uiwidget:mobicomkitui:4.1'
In 4.0, there was a setting to disable the default contact list which was coming from server for all users registered for your app, this have been removed in 4.1. Updating Applozic Chat SDK to 4.1 will solve the issue.
For 4.0, add this in UserLoginTask's "onSuccess" method:
ApplozicSetting.getInstance(context).disableRegisteredUsersContactCall();
In 4.1, in case if you want to use the contact list of all the users registered to your app, you can enable it by calling:
ApplozicSetting.getInstance(context).enableRegisteredUsersContactCall();
来源:https://stackoverflow.com/questions/37371441/how-to-list-out-my-contact-list-and-send-message-in-applozic