2
votes

I'm working facebook unity SDK, everything is fine on unity editor, but doesn't work on android device. "App stopped" when fb.init called.

I use unity 5.5.1 version and facebook sdk version is 7.9.4

here is code :

public void teststr()
    {
        if (!FB.IsInitialized) {
            // Initialize the Facebook SDK
            FB.Init(InitCallback, OnHideUnity);
        } else {

            // Already initialized, signal an app activation App Event

        }
    }
    private void InitCallback ()
    {
        if (FB.IsInitialized) {
            // ...

        } else {

        }
    }
private void OnHideUnity (bool isGameShown)
    {
        if (!isGameShown) {

            // Pause the game - we will need to hide
            Time.timeScale = 0;
        } else {

            // Resume the game - we're getting focus again
            Time.timeScale = 1;
        }
    }

teststr function fires when I clicked button

1
Can you paste the error that is shown in the logcat?Juan Bayona Beriso

1 Answers

0
votes

I've solved!

I use FB.Init(this.InitCallback, this.OnHideUnity);

instead of FB.Init(InitCallback, OnHideUnity);