1

我正在尝试删除在我的应用程序中为运行低内存设备(如诺基亚 Lumia 610)的用户启用动态磁贴的选项。我正在使用从 Microsoft 获得的以下代码,但一些运行 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
}
4

1 回答 1

5

我使用此代码。问题可能一直存在,我的来自 MSDN 关于低内存设备的页面:Developing for 256-MB Devices

/// <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;
于 2012-10-11T07:24:04.100 回答