Open Facebook App via Unity Script on Android?

2019-07-23 22:36发布

问题:

I want to ask if there is a way to open the Facebook App instead of opening the Site on Browser.

Im using Unity with C#.

I tried the following Code but it won´t work for me:

IEnumerator OpenFacebookPage()
    {
        Application.OpenURL("fb://hatchthepokeggofficial/");
        yield return new WaitForSeconds(1);
        if (leftApp)
        {
            leftApp = false;
        }
        else
        {
            Application.OpenURL("https://www.facebook.com/hatchthepokeggofficial");
        }
    }

It opens the App but I don´t land on the Site.

回答1:

Yes You need to use your Page ID instead of the custom URL. The code you are using is alright. You just need to use the page ID that you can get from the About Section of your page.