I'm trying to remove the option to enable live tile in my app for users running a low memory device (like the Nokia Lumia 610). I'm using the code below that I got from Microsoft but a few users running Lumia 800 and Focus i917 report that the live tile functionality disappeared after I added this.
What is the proper way of detected a low memory device?
This is the code I'm using that obviously works in the emulator and for most of the users but not for all:
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
}
I use this code. The problem is probably in the constant, mine is from MSDN page about low memory devices: 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;