androidgoogle-app-invites

Google App Invite - Failed to start


I'm trying to use Google App Invite in my project by following all the steps from its official documentation and latest configuration on GitHub.

However, it's not working at all in both debug and release version! It only shows this Snackbar message in both version:

Failed to start

It does not leave any stack trace in debug mode, and I've tried release version by installing it using Alpha Testing from my Google Developer Account. Here's my complete project configuration on release version:

Android Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package.name">

    <application
        ... >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>
    ...
</manifest>

Project-Level build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-beta6'
        classpath 'com.google.gms:google-services:2.0.0-beta6'
        // I've tried classpath 'com.google.gms:google-services:2.0.0-alpha5' too

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
...

App-Level build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.package.name"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    ...
}
...
dependencies {
    ...
    compile 'com.google.android.gms:play-services-appinvite:8.4.0'
}

apply plugin: 'com.google.gms.google-services'

Code

Intent inviteIntent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
    .setMessage(getString(R.string.invitation_message))
    .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
    .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))
    .setCallToActionText(getString(R.string.invitation_cta))
    .build();
startActivity(inviteIntent);

I've also added configuration file from Google Developers Console to app/ directory of my project, which includes the package name and SHA-1 from release key.

Any solution?


Solution

  • I finally found the answer myself. Actually, using startActivityForResult(intent, requestCode); is REQUIRED instead of only startActivity(intent); to get it working. I can't understand why it is compulsory since some developers (like myself) don't need the callback action IMO.