0

I've integrated account kit in my app and its working for most of the devices. But I get few crash reports for sdk initialization as well. Can someone figure out what I'm doing wrong?

Error:

com.facebook.accountkit.ui.AccountKitActivity}: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initializeSdk() first : at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2286) Caused by: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initializeSdk() first at com.facebook.accountkit.internal.Validate.sdkInitialized(Validate.java:82)

   public class PhoneRegActivity extends Activity {
     //variables
       @Override
     protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
         com.facebook.accountkit.AccountKit.initialize(getApplicationContext());
    setContentView(R.layout.phone_reg);
    accessToken = AccountKit.getCurrentAccessToken();
    SharedPreferences settings = getSharedPreferences("prefs", 0);
    ///codes
      }
       }

Any suggestion will be highly appreciated

user232803
  • 365
  • 6
  • 19

1 Answers1

0

There is another version of AccountKit.initialize that takes a callback.

public static void initialize(android.content.Context applicationContext,
                          AccountKit.InitializeCallback callback)

You could use that one and wait for the callback before trying to get the access token.

Alternatively you could try initializing AccountKit a little earlier by initializing it in your apps Application class and see if that helps.

John Anderson
  • 159
  • 1
  • 4