安装的应用程序的访问列表 [英] Access list of installed apps

查看:155
本文介绍了安装的应用程序的访问列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一款Windows Phone的安装的应用程序。你知不知道这是不是可以从SDK?

I need to get the installed apps of a Windows Phone. Do you know if this is available from the SDK?

推荐答案

这是可以列出安装在手机上的第三方应用程序,但只能从桌面计算机(即不是从一个应用程序在设备上运行),因此可能不是你所追求的。

It's possible to list third party applications installed on the phone, but only from your desktop machine (ie. not from an app running on the device) and thus might not be what you are after.

首先,你需要添加到该程序集的引用:

Firstly, you need to add a reference to this assembly:

C:\Program文件(x86)\Common Files\microsoft shared\Phone Tools\CoreCon\10.0\Bin\Microsoft.Smartdevice。 Connectivity.dll

c:\Program Files (x86)\Common Files\microsoft shared\Phone Tools\CoreCon\10.0\Bin\Microsoft.Smartdevice.Connectivity.dll

然后将以下代码将连接到仿真器( useEmulator = FALSE 的设备),并写入安装在控制台中的所有应用程序的产品ID。

Then the following code will connect to the emulator (useEmulator = false for a device) and writes the product IDs of all the applications installed to the console.

int locale = CultureInfo.CurrentCulture.LCID;
bool useEmulator = true;

var datastoreManager = new DatastoreManager(locale);

var phonePlatform = datastoreManager.GetPlatforms()
    .Single(p => p.Name == "Windows Phone 7");

var phoneDevice = phonePlatform.GetDevices()
    .First(d => d.IsEmulator() == useEmulator);

phoneDevice.Connect();

var apps = phoneDevice.GetInstalledApplications();

foreach(RemoteApplication app in apps)
{
    Console.WriteLine(app.ProductID.ToString());
}

phoneDevice.Disconnect();



一些注意事项:

Some caveats:

    $ B $正如前面提到的这个码b
  • 在.NET运行在桌面上,而不是手机本身

  • 只有产品ID提供给您,访问类型标题将抛出一个 NotImplementedException

  • 我的避风港'T包含任何错误处理

  • 这不是一个正式支持的API,以我的知识和可能发生变化。

  • As previously mentioned this code runs on .NET on the desktop, not on the phone itself
  • Only ProductID is available to you, accessing Genre or Title will throw a NotImplementedException
  • I haven't included any error handling
  • This isn't an officially supported API to my knowledge and may change.

这篇关于安装的应用程序的访问列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆