android-contacts

How to read call log history of a device in android in 6.0

[亡魂溺海] 提交于 2020-01-05 04:18:13
问题 My main aim of the app is to read the call history of the device and show it to the user using recyclerview and cardview. But When i run on marshmallow device app getting force close. Here is the code that i have used to read call history and the error that i got, when i run on 6.0 My MainActivity look like: public class MainActivity extends AppCompatActivity implements Callbacks { ArrayList<CallLogItem> mItems = new ArrayList<>(); private RecyclerView mRecyclerView; private RecyclerView

Attempting to get contact _ID using email address

余生颓废 提交于 2020-01-03 01:56:08
问题 I know that with aggregation contact _ids are not static, but may change over time (see: Google Group Discussion). So, in my app I am storing the content lookup key and the current id of a selected contact. What I am trying to do is this: when a message comes in from a particular email address, query the phone contacts and see if that from email address is associated with any of them, and then compare that contact with my stored contact, first doing a fresh query using my stored contact _id

Android: get contact id after insert

吃可爱长大的小学妹 提交于 2020-01-02 04:33:04
问题 I need to store the contact id value after create a new contact, in order to be able to reference it in other moment. For example, I create a new contact, and after that I want to delete it from its contact id, so I need to retrieve the contact id value after create a new contact. This is how I create new contacts: ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI).withValue

Use Android Contacts app to edit a raw contact which was added by a custom ContentProvider

喜夏-厌秋 提交于 2020-01-01 16:59:17
问题 My app adds contact ' Bob ' to the address book using a custom ContentProvider . In the Android Contacts app, Bob shows up just as any other (Google) contact. But when I edit Bob in the Contacts app, the data provided by my application is not editable. So far so good. My question is : From within my app, is there a way to fire up the Contacts app, in a way that allows the user to edit the portion of Bob that belongs to my app? I have tried to use the corresponding Intent , as described in

How to find the max image size supported for contacts images?

断了今生、忘了曾经 提交于 2020-01-01 05:32:31
问题 background starting with jelly bean (4.1), android now supports contact images that are 720x720 . before, starting with ICS (4.0), android has supported contact images that are 256x256. and before that, contact photos had just a size of a thumbnail - 96x96 the question is there any function in the API that returns the max size of the contact image? i also hope that the manufacturers didn't change the max image sizes, and even if they did and we have such a function, it would return us the

Display custom sync adapter as an option when adding contacts

随声附和 提交于 2020-01-01 00:49:09
问题 I am writing a custom sync adapter following the example in the SDK sample, and things seem to be working well. I can sync back contacts from my server and have them appear in the Contacts app. However, I am unable to add a contact directly to my server. Specifically, I want my sync adapter to appear as an option in the Spinner on the add contact screen, in addition to Google and Corporate, as shown in the screenshot. I couldn't find anything on the interwebs that talks about this. 回答1: Ok I

Understanding architecture of Android contacts

谁都会走 提交于 2019-12-31 10:20:09
问题 I am developing an Android app which needs to know when a contact is added/updated/deleted. So I read several posts for it. I understand that we can get notified through Content observers whenever a contacts gets changed, but we can't get which contacts have been added/updated/deleted. So I have read the official APIs and prepared my design how to capture that particular contact. So what I thought at the start We will store all the contact IDs, deleted flag and version Whenever contacts get

Android display contacts of type custom

天涯浪子 提交于 2019-12-31 05:11:28
问题 I have imported an sample of Contact List...Form this link... http://developer.android.com/training/contacts-provider/display-contact-badge.html this is working fine with all functionality.... Now in list if i want to display only some of the contact...the where should i fire a query for that ..and how... if any one has work on it...please help me... Thanks in advance.... 回答1: you can also modify this query dear cntx.getContentResolver().query(Contacts.CONTENT_URI, CONTACTS_SUMMARY_PROJECTION

Android ContactsContract class: How to ignore non-primary ACCOUNT_TYPES?

杀马特。学长 韩版系。学妹 提交于 2019-12-31 03:03:24
问题 So I know by now that I can use ContactsContract class to list all contacts available on an android device. Something like this: private void getContacts(){ ContentResolver resolver = getContentResolver(); Cursor cursor = resolver.query(ContactsContract.contacts.CONTENT_URI,null,null,null,null); while(cursor.moveToNext){ //get contact id ..... //get contact name .... } } What do I mean by contact above: A contact according to my understanding is a set of raw_contacts . Example: These are 2

Add one contact with multiple numbers Android programmatically

≡放荡痞女 提交于 2019-12-30 13:02:04
问题 How to add one contact with multiple numbers on android phone programmatically? 回答1: This is how we can do this pass Name and Array of numbers to this method. public static void addToContactList(Context context, String strDisplayName, String[] strNumber) throws Exception { ArrayList<ContentProviderOperation> cntProOper = new ArrayList<>(); int contactIndex = cntProOper.size();//ContactSize ContentResolver contactHelper = context.getContentResolver(); cntProOper.add(ContentProviderOperation