android-contacts

Reacting to new contacts in Android Contacts application

孤街醉人 提交于 2019-12-05 00:57:02
问题 I would like to perform a certain operation every time a user adds a new contact in the Android Contacts application. It would include using the new contact's information. Is there an easy way to do this? Is there some event that can be listened for or do I have to extend the Contacts application itself? Or should I just think of some other approach if this is not feasible. 回答1: It looks like your best course of action on this is to run a lightweight background service that uses a content

Retrieving group of particular contact

折月煮酒 提交于 2019-12-05 00:47:53
问题 I want to retrieve the contact details along with the group which it belongs to. I got the code to list all the contact groups in the phone. Cursor groupC = getContentResolver().query( ContactsContract.Groups.CONTENT_URI, null, null, null, null); while (groupC.moveToNext()) { String groupid = groupC.getString(groupC.getColumnIndex(ContactsContract.Groups._ID)); Log.e("myTag", groupid); String grouptitle = groupC .getString(groupC.getColumnIndex(ContactsContract.Groups.TITLE)); Log.e("myTag",

How to backup/restore a contacts in android programmatically?

风格不统一 提交于 2019-12-04 19:34:26
Hello sackoverflow I'm trying to develop an application which can backup and restore contacts, my code is as follows public class MainActivity extends Activity { Cursor cursor; ArrayList<String> vCard ; String vfile; FileOutputStream mFileOutputStream = null; Button btnRestorects = null; Button btnBackupCts = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnRestorects = (Button) findViewById(R.id.buttonRstCts); btnBackupCts = (Button) findViewById(R

Android get sms from inbox, optimized way to read all messages and group them

痴心易碎 提交于 2019-12-04 17:37:40
问题 Hi am implementing a SMS App, now am able to retrieve all messages with their respective contact info like display name, photo uri.. and am displaying them in a custom list where on item click takes you to respective discussion. Here my issues is the time taking to sync all these messages, I need to optimize this time. Each time i send a new message in the discussion view and go back to recent chats i need to only update the particular item, not the whole list. Here's my code: ReadSMS.java:

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

自古美人都是妖i 提交于 2019-12-04 16:28:00
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 " + ContactsContract.CommonDataKinds.Phone.TYPE +"=" + ContactsContract.CommonDataKinds.Phone.TYPE_MAIN;

Android contact info update with intent?

ぐ巨炮叔叔 提交于 2019-12-04 16:22:19
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? 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(ContactsContract.Contacts.CONTENT_ITEM_TYPE); i.putExtra(Insert.NAME, "TESTTEST"); i.putExtra(Insert.PHONE, "209384");

How to add app connections to an existing contact like WhatsApp and Viber does?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 15:52:36
I want my android app's connection to be added in an existing contact. I am sending my all contacts of Phonebook to server(with Name,Phone Number, and Contact ID) to check which contacts are registered for my app. I will send back to client app the contact IDs which are matched. Now I want to add connection to those contacts in my Phonebook based on those returned IDs. How can I add app connection by editing the contact based on one of returned contact ID? Thanks Try with this code, it will give you desired output public static void addContact(Context context, MyContact contact) {

Get a single phone number from contacts Android

允我心安 提交于 2019-12-04 14:38:43
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 cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null,null, null); if (cur.getCount() > 0) {

How to make a custom account show up like Google/LinkedIn/Facebook in the native Contacts app?

元气小坏坏 提交于 2019-12-04 14:36:44
问题 I'm currently working on an application, where we are going to be adding contacts from our own application, similar to how LinkedIn has connections and Facebook has friends. Therefore we want our custom account, that is shown in the images below (as " MyAppName ") with the contacts added from our application: We currently have a SyncAdapter as seen from the first image, as just wish for this to be shown in the Contacts application. We've been looking at documentation, but couldn't find

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

点点圈 提交于 2019-12-04 12:44:21
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 this Android guide , but using the raw contact uri for Bob : Uri rawUri = getRawContactUri("Bob"); Intent