Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

uwp - Open external application from Universal Windows app

I need to open an external application (Cisco Jabber Video for Telepresence) when a user selects the "video call" option in my app.

I have found that it is not possible to open the location of the executable in a Universal app...

I have also found that I cannot open an application when it is not associated with any URI schemes...

Is there any way I can do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Thanks to Microsoft MVA, some options were presented to us (you just have to fiddle them out):

Solution 1 (recommended by this Microsoft MVA tutorial):
If you want to start a specific application, you have to create a URI scheme registration, that only the specific application you want to start can handle. Using the Launcher, you can call a specified URI that will only be handled by one application (e.g. my-cool-uri-scheme://start?param1=123&param2=ABC).

Note: The user will always have the final choice which app to start with a specified URI (that's why this solution is recommended by Microsoft).

The following solutions will most likely only work in enterprise environments!

Solution 2 (clean workaround):
You have to write a proxy Windows application.
This proxy application (almost as in solution #1) registers itself with a specific file extension.
From your UWP app, you then call an imaginary file path containing your parameters (e.g. C:/Users/CURRENTUSER/AppData/Roaming/YOURAPP/PARAM1/PARAM2/PARAM3/open.my-cool-extension) - or event the file itself containing the parameters (e.g. XML or RESTful).
The handling application will then use those information to start a specific application (using Process.Start) with your given parameters.

Solution 3 (dirty workaround):
You have to write an observing Windows application. This application creates a FileSystemWatcher listening to a specific folder. So why is this the dirty workaround? Because you...

  1. Have to create a FileSystemWatcher permanently watching a specific drop directory for you UWP app.
  2. The user has no control about what will happen (no possibility to override the application to start)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...