I want to add Contacts in phone book. I can add contacts in iPhone properly but in documentation I got to know that in Android, phone book is ReadOnly !!!
Is there any other way to add ?
Thanks..
I want to add Contacts in phone book. I can add contacts in iPhone properly but in documentation I got to know that in Android, phone book is ReadOnly !!!
Is there any other way to add ?
Thanks..
Solved ! I got help from this Link . We can add contacts in Android by Intent.
if (Titanium.Platform.name == 'android')
{
var intent = Ti.Android.createIntent
({
action: 'com.android.contacts.action.SHOW_OR_CREATE_CONTACT',
data: 'mailto:'+firstName+' '+lastName
});
intent.putExtra('email', email);
intent.putExtra('email_type', 'Work');
intent.putExtra('phone', mobileno);
intent.putExtra('phone_type', 'mobile');
intent.putExtra('name', firstName+' '+lastName);
Ti.Android.currentActivity.startActivity(intent);
}
Alternatively, you can create a new contact by using the createPerson method. You just have to make sure that you have the proper names and structure for each of the properties. Note that the phone numbers are arrays.
Ti.Contacts.createPerson({
'firstName':fn.value,
'lastName':ln.value,
'phone':{'mobile':[mobile.value]}
});