0

I have tried the following links

How do I launch other app from my own app in Windows Phone 8.1?

Call an external app on windows phone 8.1 runtime(not silverlight) xaml c# application

but nothing is working for me as i simply wants to launch one app for e.g. angry birds from my app using a button click.

Please Help

Community
  • 1
  • 1
Shanky
  • 15
  • 6

2 Answers2

2

If the app has a registered URI, then you should be able to use Launcher.LaunchUriAsync for this. You can also find some help, here at MSDN - How to launch the default app for a URI.

Otherwise I don't think it's possible.

Romasz
  • 29,662
  • 13
  • 79
  • 154
  • I have downloaded and installed this(twin jellies) app in my phone http://www.windowsphone.com/en-in/store/app/twin-jellies/391f8a75-d469-4d0a-957c-11ba66675238 so now how to launch directly from my app without opening windows store.. – Shanky Jun 09 '15 at 11:26
  • @Shanky Check if developer has registered URI for the application. – Romasz Jun 09 '15 at 11:32
  • the URI of twin jellies is this (391f8a75-d469-4d0a-957c-11ba66675238) how to check if the developer has registered ? – Shanky Jun 09 '15 at 11:50
  • @Shanky That's not the URI. You can take a look how registered URIs look likte [for example here](http://stackoverflow.com/a/18616403/2681948). Most of the apps doesn't have registered URI and I doubt that dev has registered for this app. You may always contact with the developer and ask him. – Romasz Jun 09 '15 at 12:23
  • :Thanksss for your kind help :) :-) – Shanky Jun 09 '15 at 13:02
0

It works for me.

  1. setup your app which launch from other.

    add this in WMAppManifest.xaml between < /token> and < ScreenResolutions>

    <Extensions>
       <Protocol Name="alsdkcs" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
    </Extensions>
    

    add a class "AssociationUriMapper " and override the function "MapUri()"

    class AssociationUriMapper : UriMapperBase{
       private string tempUri;
    
       public override Uri MapUri(Uri uri){
          tempUri = System.Net.HttpUtility.UrlDecode(uri.ToString());
          if (tempUri.Contains("alsdkcs:MainPage?id=")){
             int idIndex = tempUri.IndexOf("id=") + 3; //3 is the length of "id="           
             string id = tempUri.Substring(idIndex);
    
             return new Uri("/MainPage.xaml?id=" + id, UriKind.Relative);
         }
         return uri;
      }
    }
    

    and call them from other app.xaml.cs at this section of InitializePhoneApplication() function

    RootFrame.UriMapper = new AssociationUriMapper(); // add this line only between RootFrame.Navigated += CompleteInitializePhoneApplication; and RootFrame.NavigationFailed += RootFrame_NavigationFailed;
    
  2. finally call fron other app to launch an app

    var success = await Windows.System.Launcher.LaunchUriAsync(new System.Uri("alsdkcs:MainPage?id="+5)); 
    if (success){
       // URI launched
    }
    else{
      // URI launch failed
    }
    

    where "alsdkcs" is protocol name.

more details see msdn

reza.cse08
  • 5,938
  • 48
  • 39