Skip to content Skip to sidebar Skip to footer

Conflict With Activity Tags On Android Manifest: Facebook And Google Play Games In Unity3d

Both Facebook and Google Play Games plugins require that I use android.intent.action.MAIN and android.intent.action.LAUNCHER in the Android Manifest. But one cancels the other. I'm

Solution 1:

Yes there is a workaround! In your main activity class in java, you can add this to the onActivityResult() method:

Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);

if you don't have access to the source of com.bfsgooglegames.GoogleGamesUnityPlayerActivity which is the main activity you are using, you can create another class that extends that one. example:

import android.content.Intent;
import android.os.Bundle;
import com.facebook.Session;

publicclassMyMainUnityPlayerActivityextendscom.bfsgooglegames.GoogleGamesUnityPlayerActivity {
  @OverrideprotectedvoidonCreate(Bundle arg0) {
    super.onCreate(arg0);
  }

  @OverridepublicvoidonActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
  } 
}

Then in your AndroidManifest.xml, use that as your main activity.

Solution 2:

@OverridepublicvoidonActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    **if( null != Session.getActiveSession() )**
    {   
        Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
    **}**
  } 

If you do not do this, you must first login Facebook a more complete way.

The initial value is a null value because the session because it is.

Post a Comment for "Conflict With Activity Tags On Android Manifest: Facebook And Google Play Games In Unity3d"