Skip to content

Commit

Permalink
Removed fetching app configuration data before calling FB.Init
Browse files Browse the repository at this point in the history
Summary:
Removed fetching app configuration data before calling FB.Init in BaseActivity.java.

Seems like old UnityEngine versions had issues with Share methods but testing with Unity 2019 ( the minimum Unity Engine supported since version 14.1.0 ) this  issue is not happening anymore.

Reviewed By: SergioGuerreroFB

Differential Revision: D45940165

fbshipit-source-id: fecc3b1c5910ec74aa757a6e118435d843b1b86d
  • Loading branch information
JordiFB authored and facebook-github-bot committed Jun 15, 2023
1 parent 7ba25ae commit 7fe6774
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ public abstract class BaseActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCallbackManager = CallbackManager.Factory.create();

// During a share or other activity switch this activity may be destroyed.
// The UnityActivity will also get killed and the developers game will need to restart and
// the callback won't be registered. But to avoid throwing an exception initialize the sdk
// to allow the callback to complete.
if (!FacebookSdk.isInitialized()) {
FacebookSdk.sdkInitialize(getApplicationContext());
}
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions facebook-android-wrapper/src/com/facebook/unity/FB.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public static void Init(final String params_str) {
// (Deprecated) Attempt to initialize SDK manually with FB.Init args
FacebookSdk.setClientToken(unity_params.getString("clientToken"));
FacebookSdk.setApplicationId(appID);
FacebookSdk.setAutoInitEnabled(true);
FacebookSdk.fullyInitialize();
FacebookSdk.sdkInitialize(FB.getUnityActivity(), new FacebookSdk.InitializeCallback() {
@Override
public void onInitialized() {
Expand Down

0 comments on commit 7fe6774

Please sign in to comment.