Joh*_*ohn 1 windows-phone-7 live-tile
我正在尝试删除在我的应用中为运行低内存设备(如诺基亚Lumia 610)的用户启用动态磁贴的选项.我使用的是我从微软获得的代码,但运行Lumia 800和Focus i917的一些用户报告说,添加此功能后,实时磁贴功能消失了.
检测低内存设备的正确方法是什么?
这是我正在使用的代码,显然可以在模拟器和大多数用户中使用,但不适用于所有用户:
long result = 0;
try
{
result = (long)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit");
}
catch (ArgumentOutOfRangeException)
{
//The device has not received the OS update, which means the device is a 512-MB device.
}
if (result < 90000000)
{
//Low memory device
}
Run Code Online (Sandbox Code Playgroud)
我用这个代码.问题可能在于常量,我的是来自MSDN页面的低内存设备:为256 MB设备开发
/// <summary>
/// Flag if device is Low-memory Tango device or not.
/// </summary>
public static bool IsLowMemDevice
{
get
{
if (!isLowMemDevice.HasValue)
{
try
{
// check the working set limit
long result = (long) DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit");
isLowMemDevice = result < 94371840L;
}
catch (ArgumentOutOfRangeException)
{
// OS does not support this call => indicates a 512 MB device
isLowMemDevice = false;
}
}
return isLowMemDevice.Value;
}
}
private static bool? isLowMemDevice;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
534 次 |
| 最近记录: |