android-contacts

Android: Directory data provider for PhoneLookup

白昼怎懂夜的黑 提交于 2019-12-07 02:48:44
问题 I'm writing a custom Android contacts directory, I have implemented the ContactsContract.Directory provider and the search from within the phone app works fine. The problem I am facing now is that when I have an incoming/outgoing call the Android dialer does not query the custom directory I registered. Is it possible to partake in caller ID resolution via PhoneLookup or some other way? Also as a possible workaround I have tried implementing an outgoing/incoming call interceptor with

Displaying contacts only with phone numbers using ACTION_PICK intent in Android device

巧了我就是萌 提交于 2019-12-06 22:14:05
问题 My goal is to only display contacts with phone number to user and let user select few contacts which I want to store locally. I have used various options in place of ContactsContract.Contacts.CONTENT_URI in below method. But I am getting lot many of the contacts (many are junk with only email ids) displayed. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contact_selector); ((Button)findViewById(R.id.btnphonecontactlist))

Contact fetching takes too much time

ε祈祈猫儿з 提交于 2019-12-06 20:57:26
In my code the contact fetching takes too much time to fetch the contacts and show in the application. Please guide me where i am wrong and what should i correct in order to make execution time fast. Here is my code. ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null ); String phone = null; List<String> phonenumber = new ArrayList<String>(); String emailContact = null; String emailType = null; String image_uri = ""; Bitmap bitmap = null; if (cur.getCount() > 0) { while (cur.moveToNext()) { String id = cur.getString(cur

Get the SIM number used on a call through the call log of Android

半腔热情 提交于 2019-12-06 15:32:46
I know Android SDK is big mess for dual SIM support, but stock dialer shows this information on call log which SIM card ( 1 or 2) was used in a call. I guess it´s stored on call log default database and just want to know if it is possible to retrieve it as simple as possible. I don´t need to know if the SIM is the current one in use. By the way, probably the call log became3s a big mess if you change the Sim cards... but it is another subject and does not matter for me (at the moment ;-) My questions: 1- Is it possible to get it ? 2- Is it a simple query on the file/database? I found an app

android showing both sim and phone contacts

妖精的绣舞 提交于 2019-12-06 11:27:30
问题 In my code I should display only phone contacts: I followed previous posts but I still display both phone and sim contacts. Here it is my code: Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String columIndex = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME; String columIndexId = ContactsContract.CommonDataKinds.Phone.CONTACT_ID; String numIndex = ContactsContract.CommonDataKinds.Phone.NUMBER; Cursor cursor = getContentResolver().query(uri, null, null, null

Obtaining contacts from content provider without duplicates or invalid contacts, and save to Realm

故事扮演 提交于 2019-12-06 09:53:19
问题 I have this code (thankfully provided by @EpicPandaForce) and I have problem with deletion. When I add new contact it works like a charm while when I delete contact (or number from that contact if there are two of them) it stays persisted in Realm. How can I get it working properly? realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { Contact realmContact = new Contact(); String filter = "" + ContactsContract.Contacts.HAS_PHONE_NUMBER + " > 0 and " +

Duplicate entries when fetching contacts groups Android 4+

别说谁变了你拦得住时间么 提交于 2019-12-06 09:18:35
I am fetching all the contact groups using the following query: //get list of contact groups from ContactsContract Cursor groups_cursor = getContentResolver()// .query(ContactsContract.Groups.CONTENT_SUMMARY_URI,// new String[] { // ContactsContract.Groups._ID,// ContactsContract.Groups.TITLE, // ContactsContract.Groups.DATA_SET,// ContactsContract.Groups.GROUP_VISIBLE,// ContactsContract.Groups.DELETED,// ContactsContract.Groups.SYSTEM_ID,// ContactsContract.Groups.SUMMARY_COUNT, // ContactsContract.Groups.SUMMARY_WITH_PHONES // },// null, null, null);// My cursor always contains the groups

Get a single phone number from contacts Android

梦想的初衷 提交于 2019-12-06 07:23:16
问题 Hi I am trying to get a single phone number from the contact list . I have found code which gets me the whole contact list telephone numbers, all I want is the telephone number for the item clicked. Any Help would be gratefully appreciated . Thanks .. public void onClick(View v) { Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,Contacts.CONTENT_URI); startActivityForResult(contactPickerIntent,CONTACT_PICKER_RESULT); ContentResolver cr = getActivity().getContentResolver(); Cursor

Android contact info update with intent?

吃可爱长大的小学妹 提交于 2019-12-06 06:21:21
问题 I can create new contact with Intent by passing info as extra data with putExtra, is it possible to create Intent with info and if contact is already in phonebook it will be update with new info? 回答1: Actually you can use intents to create new contacts with ContactsContract and it's not deprecated. http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html example that works for me: Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT); i.setType

Android API 8 , 10 ContactsContract.Data.HAS_PHONE_NUMBER no such column

久未见 提交于 2019-12-06 06:20:06
问题 The below query runs fine on my device (API 15). It does not work in my emulator running API 8 or API 10. Here is the query: Cursor contactsCur = getContentResolver().query( ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data._ID, ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME, ContactsContract.CommonDataKinds.Organization.COMPANY, ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.Data.LOOKUP_KEY, ContactsContract.CommonDataKinds.Phone