I am trying to implement App invites in my app. Here's the java code that I am using :
Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.build();
startActivityForResult(intent, Constants.REQUEST_CODE_INVITE);
But, as soon as I am clicking on the button which executes this code, a dialog pops up saying 'Unfortunately, Google Play Services has stopped'.
I have tried disabling, uninstalling and installing google play services again, and even restarting the phone, but no use.
No Exception is shown in android studio logs, so I am not able to figure out the problem is.
Please help.
I was making a silly mistake which was leading to the error.
I was not initializing the GoogleApiClient before sending out the intent. Don't know how I missed it. Here's the code that I was missing :
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(AppInvite.API)
.enableAutoManage(this, this)
.build();
Hope it helps future visitors to this page.