1

I try to show another activity in AppInviteApi.getInvitation callback.

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .enableAutoManage(this , this )
    .addApi(AppInvite.API)
    .build();
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
    .setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
    @Override
    public void onResult(@NonNull AppInviteInvitationResult result) {
        if (result.getStatus().isSuccess()) {

            Intent intent = result.getInvitationIntent();
            String deepLink = AppInviteReferral.getDeepLink(intent);
            String[] strings=  deepLink.split("\\%");
            String key =strings[strings.length-1];
            Intent intent2=new Intent(GroupsActivity.this,MainActivity.class);
            intent2.putExtra("groupKey",key);
            startActivity(intent2);
        } else {
        }
    }
});

After this action, I observe an endless cycle in which consecutive MainActivity and GroupsActivity starts. How to correctly start an another activity in this case?

koceeng
  • 2,169
  • 3
  • 16
  • 37
Roix
  • 61
  • 4

1 Answers1

0

I've got the same problem. The endless cycle.

I start wrong intent.

you have to check your code

Intent intent2=new Intent(GroupsActivity.this,MainActivity.class);
            intent2.putExtra("groupKey",key);
            startActivity(intent2);

Check this line.

new Intent("your context", "activity your wanna go.");
Ego Slayer
  • 1,987
  • 2
  • 22
  • 17