loop
loop

Reputation: 9242

Launch One metro app from other Metro app Windows 8

I am working on a project in which i have to integrate other apps/games with my platform. Through which i can run them. So their is one bad test solution is that i make them hardcodedly integrate them inside my framework as a part of framework. But that is crap.

So, my question is can i run other installed apps(these apps will be downloaded from store separately) through some code from my platform and I know data can be transfer from one app to other apps.

It should be like when i click on Play App Button then an installed app will get start and i transfer some settings to it and when user finish playing that app some data get transfer back to my platform and my platform resumes to corresponding state.

Upvotes: 1

Views: 593

Answers (1)

souvickcse
souvickcse

Reputation: 7804

For opening other app form your app you have to know the uri for the app for example You want to open "another app"

 string anotherappURI = "anotherapp_uri_value:///?anyVariable=value";
 Uri uri = new Uri(anotherappURI);
 await Launcher.LaunchUriAsync(uri);

And if you want to make a uri for your app so that it can be open from another app please follow the steps

  1. Double click on package.appxmanifest file in the project

  2. In the Declaration tab, select "Protocol" in the drop-down list and click on add

  3. Enter "your_app_URI_displayname" as Display Name and "your_app_URI" as the Name

  4. Save these changes

Now after activation (when your app is called and opened) how get the activation

  1. Go to App.xaml.cs file
  2. Override the OnActivated method
  3. Insert this piece of code within :

Code:

  protected override void OnActivated(IActivatedEventArgs args)
  {
  if (args.Kind == ActivationKind.Protocol)
  {
  ProtocolActivatedEventArgs eventArgs = args as
  ProtocolActivatedEventArgs;
  // TODO: Handle URI activation
  // The received URI is eventArgs.Uri.AbsoluteUri
  }
  }

NOTE: Please upvote and accept it as answer if helpful

Upvotes: 3

Related Questions