android-contacts

Get phone number from contact loader in android: projection crash

人走茶凉 提交于 2019-12-11 13:33:38
问题 I am using the sample code from the Google tutorial. The projection is where I specify the data I want to collect. How do I specify that I want the phone numbers ? The sample from Google does not get phone number. But I want to obtain the phone number, so I add the field for Phone.NUMBER . But when I do, the app always crashes. Here is my projection. // The projection for the CursorLoader query. This is a list of columns that the Contacts // Provider should return in the Cursor. @SuppressLint

No contacts for my AccountManager account

僤鯓⒐⒋嵵緔 提交于 2019-12-11 13:23:58
问题 I am currently working on a project in which I want to access the mobile contacts, So I have managed to create account with accountmanager and also able to perform Syncadapter operation. I could see my account got created in the mobile settings->Accounts . However, when I try to get all the contacts with my account with below code ,it does not work. Its showing all apps(google.com and WhatsApp.com) contacts except my app account contacts. Cursor cursor = getContext().getContentResolver()

How to implement contacts filter in android phonegap?

旧巷老猫 提交于 2019-12-11 12:34:40
问题 I have an option to send text message in my application. So there is a text box to enter a mobile number. I need to dynamically populate the filtered contacts if user entering the number. I just need similar to mobile phone contact search criteria. i.e, If user types 998 I need to display the list of filtered contacts based on given input 998. To do this I have used navigator.contacts.find() , using this method I am able to get and find particular contacts. But not dynamic search criteria.

Android Wear Access Contacts

荒凉一梦 提交于 2019-12-11 12:28:53
问题 I have an app that interfaces extensively with the contacts ContentProvider . I am looking to introduce a Wear component to my app that will make use of contact data. Is Wear able to directly access the contacts through a ContentResolver or does it have to be manually synced from the mobile device? 回答1: There is no such an API allows you to directly read contacts of your phone. You may have to consider the wearable app as a separate app from you phone side app. You should sync the contacts

openContactPhotoInputStream causes “java.lang.IllegalStateException: get field slot from row 0 col 0 failed”

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:18:56
问题 Background I'm trying to check if a contact image exists for a specific contact (and later to actually get it, much later). the query should be as minimal as possible and avoid un-needed memory usage. I've figured out this probably isn't possible using the normal way, so for now I'm using: final Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, contactKey); final Cursor contactCur = mContentResolver.query(lookupUri, new String[] { ContactsContract.Contacts._ID

Effective way to get contacts info with photo

守給你的承諾、 提交于 2019-12-11 11:57:10
问题 I want to get some basic info of all contacts(I use api lvl 8). Currently i use this code snippet private List<ContactInfo> readContacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, Phone.DISPLAY_NAME + " ASC"); for (int i = 0; i < cur.getColumnCount(); i++) { Log.v("COlum", cur.getColumnName(i)); } List<ContactInfo> temp = new ArrayList<ContactInfo>(); if (cur.getCount() > 0) { while (cur.moveToNext()) {

Start add new contact activity and pass structured data

荒凉一梦 提交于 2019-12-11 11:40:41
问题 Is possible to start default people/contact activity and pass structured data like separated first name and last name, phone type, city, postal code and similar data. I use following similar code: Intent addContactIntent = new Intent(Intent.ACTION_INSERT); addContactIntent.setType(ContactsContract.Contacts.CONTENT_TYPE); addContactIntent.putExtra(ContactsContract.Intents.Insert.POSTAL, "abc 2343"); startActivity(addContactIntent ); This works fine but I can't specify which is for example

Displaying the phone number of a contact in Android Contact Content Provider

会有一股神秘感。 提交于 2019-12-11 11:23:29
问题 i am trying to write a program that would display the id, name and phone number of a contact in android. So far the Id and Names of the contact are displayed but the number of the contact doesn't. Can someone help me, below is the code for my program: package com.example.oghenekaroedoh.provider; import android.app.ListActivity; import android.content.CursorLoader; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import

Update existing contact with image in Android

自闭症网瘾萝莉.ら 提交于 2019-12-11 10:54:10
问题 I am able to update image in contact from my app and its visible in contacts but as soon as google sync occurs it deletes the image from contact. My code: ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValue(ContactsContract.Data.RAW_CONTACT_ID, lRawContactId) .withValue(ContactsContract.Data.IS_PRIMARY, 1) .withValue(ContactsContract.Data.IS_SUPER_PRIMARY, 1) .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM

contentResolver.query(ContactsContract.Contacts.CONTENT_URI…) return 0 count Cursor if called after Intent.ACTION_INSERT

南笙酒味 提交于 2019-12-11 10:50:37
问题 I'm getting a weird behavior when testing my app on Huawei P8 . Everything works nice on emulators (android version 4, 5, 6, 7) and on ASUS (android 6) and Samsung Galaxy S2 (Android 4.2). The following steps work both on physical device and emulators. After calling contentResolver.query() I get a Cursor with all the contacts of my device. I open my app I call contentResolver.query(ContactsContract.Contacts.CONTENT_URI...); The following steps work everywhere except on my Huawei P8 ; with my