Application.OpenURL("fb://profile/XXXXXX") makes Unity die with Intent not handled Ex

Hi!,

I know this worked in the past but don’t know why it doesn´t now.

I’m trying to detect if user has facebook application installed with following code:

    startTime = Time.timeSinceLevelLoad;
     
     
    //open the facebook app
    Application.OpenURL(facebookApp);
     
    if (Time.timeSinceLevelLoad - startTime <= 1f)
    {
    //if not facebook app open with browser
    Application.OpenURL(facebookAddress);
    }

This used to work, but now it doesn’t. When trying to openurl using a facebook url I get an error in the log window saying:

FATAL EXCEPTION: GLThread 2176 android.content.ActivityNotFoundException: No Activity found to handle intent { act=android.intent.action.VIEW dat=fb://profile/XXXXXXXXXXXXXXXXX

It is obvious that the exception is being raised because I don’t have any application to handle the fb:// request. Is there any way to avoid this? It seems it is impossible to catch the exception in the C# side.

P.D. Unity 3.5.7f6 here

Thanks in advance.

You might want to use some plugin for that since Android does know if there is valid intent for the URL.
Something like

and change intent to new Intent(Intent.ACTION_VIEW, Uri.parse(url))