Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Application.OpenURL causing application on WP8 phone to stop

Discussion in 'Windows' started by Memosis, Jul 23, 2013.

  1. Memosis


    Jul 23, 2013
    We call Application.OpenURL when user clicks banner in our game or when we want to display ratings in store. It works on all platforms we used so far (Win x86, Mac, Android, iOS). On WP8 phone the game simply stops. We will appreciate your experience and tips on debugging these kinds of problems.
  2. BFS-Kyle


    Jun 12, 2013
    I believe Application.OpenURL is not yet implemented in WP8, so you can't use it (seems to quit the game when it gets called). You will have to handle this yourself after exporting the build into Visual Studio and then edit the project. There is an example of how to do this in the Windows Phone 8 Beta group if you have access.

    The other alternative is to grab one of the Windows Phone 8 plugins - currently there are two that I know of, one is my own called BFS WP8 Goodies which has functionality to open URL's among other things, and the other is called RobotoWP plugin for Windows Phone which from the looks of it (I haven't purchased this plugin) can also handle opening URL's.

  3. DanielSan


    Nov 20, 2012
    Create a static class in Unity with a static event...

    Code (csharp):
    2. public static class WP8Statics
    3. {
    4.      public static event EventHandler OpenUrlHandle;   
    6.      public static void FireOpenUrl(string url)
    7.      {
    8.           if (OpenUrlHandle != null)
    9.           {
    10.                OpenUrlHandle(url, null);           
    11.           }
    12.      }
    13. }
    Build in Unity to create a VS solution. Open the solution and then attach the native browser functionality to the method you created in MainPage.xaml.cs...

    Code (csharp):
    2. // Constructor
    3. public MainPage()
    4. {
    5.      ...
    6.      WP8Statics.OpenUrlHandle += WP8Statics_OpenUrlHandle;
    7. }
    9. void WP8Statics_OpenUrlHandle(object sender, EventArgs e)
    10. {
    11.        Microsoft.Phone.Tasks.WebBrowserTask wbt = new Microsoft.Phone.Tasks.WebBrowserTask();
    12.        wbt.Uri = new Uri((string)sender);
    13.        wbt.Show();
    14. }
    Last edited: Aug 5, 2013
    jdrostov likes this.