I am trying to add a new contact in android phone. For that I am using following code.
ContentValues values = new ContentValues();
values.put(Phone.RAW_CONTACT_ID, "jadeja");
values.put(Phone.NUMBER, 1234567890);
values.put(Phone.TYPE, Phone.TYPE_MOBILE);
Uri uri = getContentResolver().insert(Phone.CONTENT_URI, values);
But it force closes the application and inside "LogCat" it shows that security permission denial. Is there any way to achieve this?
Add the following to the AndroidManifest.XML file:
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
This should be added in manifest WRITE_CONTACTS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With