I have a requirement, in which I have to add contacts into phone contact. I have Huawei android phone for which I got account type of phone contact as "com.android.huawei.phone" and account name as "PHONE". Using this data, I successfully inserted the contact and same is also appearing in phone contact. But, this will make my application device specific. Is there any way so that application works on every device? Is there any standard as which account type and name of contact table should be declared?
Asked
Active
Viewed 1,447 times
1
-
If I understood you right , this is the same question http://stackoverflow.com/questions/4459138/insert-contact-in-android-with-contactscontract – user1304907 Apr 04 '12 at 16:25
-
1No, the question is not same. I had successfully added the contact and it can be viewed in phone contacts as well. But the application has become device specific as I had used account type and name for phone contact for my device. I want this app to work on devices as well. So, in order to do so I need account type and name of those devices contact table. I can get different account types in a device from which I will choose account type and name for phone contact. But I am not getting how to check condition. Is there any condition that phone contact table should have some specific attribute? – Nitish Apr 04 '12 at 16:52
1 Answers
1
My problem has been solved. If we assign null to account name and account type, then we can easily add contacts in phone contacts.

Nitish
- 3,097
- 13
- 45
- 80
-
@Nitish, i am not sure if this is really a solution. I made the following experience: if you delete an account all contacts assigned to this account are deleted but also those which have account_name and account_type NULL. so why not creating a new account and assigning contacts and groups to this account. than your app is hardware independent. – Jun 08 '14 at 13:41
-
@hans You mean to say creating new account through app, and adding contacts to it? – Nitish Jun 09 '14 at 06:45
-
2yes exactly. check if this account exists, if not, create it. later on you don't have problems with contacts or groups. I wrote an app called "Contacts DB Analysis" ( to find here https://play.google.com/store/apps/details?id=tv.mayer.contactsanalysis ) This gives an easy way to browse through the Contacts DB and some of it's tables. It's not perfect but just fine to answer such questions during development of the own app. Read the help carefully to find all possibilities of usage. Just to see what's inside different tables. // Hans – Jun 09 '14 at 07:22