Felix
Felix

Reputation: 4081

Get list of package family names at runtime?

I know how to get the package family name for the current UWP app: Package.Current.Id.FamilyName

How do I find the package family name for other UWP apps the user has installed?

Specifically I'm interested in apps for a certain protocol, and so FindAppUriHandlersAsync(Uri) looked promising, but sadly that always returns an empty list for me.

Any ideas?


Edit

Here is the uri scheme registration in the apps I'm interested in:

<Application 
    ...>
    <Extensions>
    <uap:Extension Category="windows.protocol">
        <uap:Protocol Name="my-great-protocol" ReturnResults="none">
        <uap:DisplayName>My Great Protocol</uap:DisplayName>
        </uap:Protocol>
    </uap:Extension>
    </Extensions>
</Application>

And it seems to work as launching my apps works:

await Launcher.LaunchUriAsync(new Uri("my-great-protocol:"));

But this still returns an empty list:

var apps = await Launcher.FindAppUriHandlersAsync(new Uri("my-great-protocol:"));

Upvotes: 1

Views: 578

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32785

Get list of package family names at runtime?

For your requirement, you could refer this UWPTaskMonitor code sample that use AppDiagnostic api to get running UWP apps info. And this related blog that you could refer.

Update

Derive from this document,

A list of AppInfo objects representing each application that handles the specified http(s) URI.

Launcher.FindAppUriHandlersAsync(Uri) method could use to get app's info that you need to register to handle http and https links in the app manifest first, for the detail steps please refer this.

Update 2

For example:

<Application ...>
    <Extensions>
        <uap3:Extension Category="windows.appUriHandler">  
            <uap3:AppUriHandler>  
            <uap3:Host Name="my-great-host.com" />  
            </uap3:AppUriHandler>
        </uap3:Extension>  
    </Extensions>
</Application>

and

var apps = await Launcher.FindAppUriHandlersAsync(new Uri("http://my-great-host.com"));

Upvotes: 1

Related Questions