how can i get Viber contacts (Name and number)?
学习当地常用口语可以快速融入当地文化,如问路:'Excuse me, how can I get to...?' #生活知识# #旅游生活# #旅游语言学习#
This question shows research effort; it is useful and clear
2
Save this question.
Show activity on this post.
I am trying to get Viber contacts. Using this method i get the name of the contacts that use Viber but also other contacts that do not use Viber (the selection method is not working properly) .I cant get the Viber contacts number also. Any idea how can i resolve this issue?
Cursor cursor2 = getContentResolver().query(ContactsContract.RawContacts.CONTENT_URI ,null , ContactsContract.RawContacts.ACCOUNT_TYPE_AND_DATA_SET + "= ?" ,new String[] { "com.viber.voip" } , null); while (cursor2.moveToNext()) { String name=cursor2.getString(cursor2.getColumnIndex(ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY)); //Adding contact name into the ArrayList myViberContacts.add(name+"\n"); //Giving the TextView the value of the arraylist emervib.setText(myViberContacts.toString());
Mobile Development Collective
asked Sep 3, 2020 at 18:08
This answer is useful
0
Save this answer.
Show activity on this post.
I believe this code should work for you:
String MIMETYPE_VIBER_MESSAGE = "vnd.android.cursor.item/vnd.com.viber.voip.viber_number_message"; String selection = Data.MIMETYPE + "=?"; String[] selectionArgs = new String[] { MIMETYPE_VIBER_MESSAGE }; String[] projection = new String[] { Data.CONTACT_ID, Data.DATA1, Data.DISPLAY_NAME }; Cursor cur = getContentResolver().query(Data.CONTENT_URI, projection, selection, selectionArgs, null); DatabaseUtils.dumpCursor(cur); // check logcat for the results
answered Sep 6, 2020 at 11:45
Comments
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
See similar questions with these tags.
网址:how can i get Viber contacts (Name and number)? https://klqsh.com/news/view/318879
相关内容
Viber: Extract contact numbers & Names of a one particular VIBER groupHow To Get PM Kisan Registration Number?
How to Get PM Kisan Registration Number: Full Process
Viber API get all subscribers
How can I install clang
How do I check warehouse inventory?
How can I locate a product on Costco.com?
How do I place an order on Costco.com?
How to Get Started Playing Guitar: 10 Beginner FAQs
Free vCard QR Code Generator

