I'm using react-native-contacts
inside my react native app to save a contact.
Before saving I request WRITE permission from android.
It works, I open the contact form through my app and save it using the contact form. The contact is saving properly. But, after I have saved the contact, it goes to the home screen, not to my app.
I want to return to my app after the contact is saved.
here is my code,
saveContact = user => {
var newPerson = {
emailAddresses: [
{
label: "work",
email: user.email
}
],
phoneNumbers: [
{
label: "mobile",
number: user.mobileNumber
}
],
displayName: user.firstName + "" + user.lastName
};
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_CONTACTS, {
title: "Contacts",
message: "This app would like to write contacts.",
buttonPositive: "Please accept bare mortal"
}).then(() => {
Contacts.openContactForm(newPerson, (err, contact) => {
if (err) throw err;
// contact has been saved
});
});
};