0

I just implemented the Firebase Invites in my android app. I followed the online documentation as per the API Specs @ https://firebase.google.com/docs/invites/android

As per that I implemented the below code in the onActivityResult method.

@override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode);
    if (requestCode == REQUEST_INVITE) 
    {
        if (resultCode == RESULT_OK) 
        {
            // Get the invitation IDs of all sent messages
            String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data);
            for (String id : ids) 
            {
                Log.d(TAG, "onActivityResult: sent invitation " + id);
            }
        } 
        else 
        {

        }
    }
}

Currently the intent only has extra parameters set for the generated invitation IDS i.e. we can only get Generated invitation Ids.

IS there a way we can get the Contact Name( email/phone # ) chosen in the invitation page from the contacts provider returned back in the intent that can be captured in the onActivityResult

Something like

 T[] contacts = AppInviteInvitation.getInvitedContact(...)....
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

The current Firebase Invites API does not support obtaining contact information for an invite recipient.

The Android OS treats contacts as protected information. An app must have the READ_CONTACTS permission to access contact information. Because it is classified as a dangerous permission, the user must grant the the permission when the app is installed (older API levels) or when needed.

My guess is that the designers of the Firebase Invites API did not provide access to the contact info so that clients using the API would not need the permission. The contact information needed to send invites is accessed in a protected part of the SDK, so the client gets the benefit of using the contact information without needing the permission to read it. This makes an app using Invites safer and more attractive to users who want to limit access to their contacts.

Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
  • Thanks Bob. What I intend to do is to print a confirmation on the sender side and store the name of the contact with its Invitation IDs and flag-it as pending. Something similar to a Friend Request ..and once the Recipient actually clicks on the underlying Dynamic link of the invite .. the APP will send a message to my App Server with teh Invitation ID and It can me marked as "Accepted".... – Priyadarshan Vyas Jan 03 '18 at 18:54