Browse files

Merge pull request #1031 from jankalfus/master

Fix for incorrect initialization of FBSDKPackage for Android
  • Loading branch information...
2 parents c06bbf4 + 058b797 commit fc1932103b72cb955952273d6d96b3db4494cc88 @steida steida committed on GitHub Jul 26, 2016
View
7 android/app/src/main/java/com/este/MainActivity.java
@@ -1,5 +1,6 @@
package com.este;
+import android.content.Intent;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
@@ -12,4 +13,10 @@
protected String getMainComponentName() {
return "Este";
}
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
+ }
}
View
18 android/app/src/main/java/com/este/MainApplication.java
@@ -6,6 +6,8 @@
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import io.fixd.rctlocale.RCTLocalePackage;
+import com.facebook.CallbackManager;
+import com.facebook.FacebookSdk;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
@@ -17,6 +19,20 @@
public class MainApplication extends Application implements ReactApplication {
+ private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
+
+ protected static CallbackManager getCallbackManager() {
+ return mCallbackManager;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ FacebookSdk.sdkInitialize(getApplicationContext());
+ // If you want to use AppEventsLogger to log events.
+ //AppEventsLogger.activateApp(this);
+ }
+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
@@ -29,7 +45,7 @@ protected boolean getUseDeveloperSupport() {
new MainReactPackage(),
new VectorIconsPackage(),
new RCTLocalePackage(),
- new FBSDKPackage()
+ new FBSDKPackage(mCallbackManager)
);
}
};

0 comments on commit fc19321

Please sign in to comment.