3

I am creating a app where i need to backup and restore contacts programmatically to and from my website.

Here i have completed one part(backup contacts).

In the other part(importing contacts) i use this code.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new     File(Environment.getExternalStorageDirectory()+File.separator+"Contacts.vcf")),"text/x-vcard"); //storage path is path of your vcf file and vFile is name of that file.
startActivity(intent);

This code works 90% perfectly,only one problem is that when this code gets called a alert dialogue gets displayed and we have to manually select where to restore the contacts.

e.g Phone,email id

How can i make it auto called,so that whenever this code gets called Contacts gets restored automatically to Phone memory ?

Jay Vyas
  • 2,674
  • 5
  • 27
  • 58

1 Answers1

1

You can insert or import contacts via ContactProvider class.

Jay Vyas
  • 2,674
  • 5
  • 27
  • 58
Harshit Rathi
  • 1,862
  • 2
  • 18
  • 25