androidfirebasefirebase-invites

Cannot resolve REQUEST_INVITE


I would like to add the firebase invite to my android app. I followed the steps in the tutorial ( https://firebase.google.com/docs/invites/android ), but I have this error

Cannot resolve symbol REQUEST_INVITE

I added firebase core and invite to my app already and when I clicked on Dynamic links in the consol, it did not asked me to accept anything.

The gradle :

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.google.firebase:firebase-invites:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin :'com.google.gms.google-services'

the java file :

    //sent Invite
private void onInviteClicked(){
    Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
            .setMessage(getString(R.string.invit_message))
            .setCallToActionText(getString(R.string.invit_cta))
            .build();
    startActivityForResult(intent, REQUEST_INVITE);
}

The google service json:

"services": {
    "analytics_service": {
      "status": 1
    },
    "appinvite_service": {
      "status": 1,
      "other_platform_oauth_client": []
    },
    "ads_service": {
      "status": 2
    }
  }

or does the REQUEST_INVITE is a variable we have to set depending on the ID of our app on the playstore ? If so, is it possible to know that ID before launching it ?

Thank you a lot for your help


Solution

  • REQUEST_INVITE is simply a static final int that you define in the activity where it is used. For example:

    private static final int REQUEST_INVITE = 0;
    

    See the code on the Quickstart Sample.