bring uwp app in foreground

怎甘沉沦 提交于 2019-12-30 13:32:54

问题


I found posts about how to detect if the app runs in foreground. Is it possible to bring my UWP app to the foreground (when it runs in the background) somehow? Maybe it's possible with a background task?


回答1:


This is how I got it to work for UWP running on Windows 10:

  1. In your manifest create a protocol declaration (insert Name and Display name meaningful to your app)

  2. In App settings for the protocol change the Desired view to Use Half

  3. Use the Launcher to call your registered protocol whenever your app should come to the foreground

In the example below replace yourprotocolhere with the protocol you registered for your app.

await Windows.System.Launcher.LaunchUriAsync(new Uri("yourprotocolhere://"));


来源:https://stackoverflow.com/questions/42176570/bring-uwp-app-in-foreground

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!