Search Unity

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

Discussion in 'Android' started by hexdump, Jul 12, 2013.

  1. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    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:

    Code (csharp):
    1.  
    2.     startTime = Time.timeSinceLevelLoad;
    3.      
    4.      
    5.     //open the facebook app
    6.     Application.OpenURL(facebookApp);
    7.      
    8.     if (Time.timeSinceLevelLoad - startTime <= 1f)
    9.     {
    10.     //if not facebook app open with browser
    11.     Application.OpenURL(facebookAddress);
    12.     }
    13.  
    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.
     
  2. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899