private void GetFixedFeatures() { Version v = Environment.OSVersion.Version; bool g = Gyroscope.IsSupported; bool a = Accelerometer.IsSupported; bool c = Compass.IsSupported; bool p = Camera.IsCameraTypeSupported(CameraType.Primary); bool f = Camera.IsCameraTypeSupported(CameraType.FrontFacing); int i = App.Current.Host.Content.ScaleFactor; } private void GetDynamicFeatures() { bool d = DeviceNetworkInformation.IsCellularDataEnabled; bool r = DeviceNetworkInformation.IsCellularDataRoamingEnabled; bool x = (DeviceStatus.PowerSource == PowerSource.External); ConnectionProfile profile = NetworkInformation.GetInternetConnectionProfile(); ConnectionCost cost = profile.GetConnectionCost(); } private void AddEventHandlers() { DeviceNetworkInformation.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged; NetworkInformation.NetworkStatusChanged += OnNetworkStatusChanged; DeviceStatus.PowerSourceChanged += OnPowerSourceChanged; PowerManager.PowerSavingModeChanged += OnPowerSavingModeChanged; }
App/Agent Type512MB device1GB device2GB device VOIP Background Audio Playback20*25* Generic Background Agents11*20 Continuous Background Execution 150 Foreground App**150/150/180150/300/380150/450/570 Foreground App**150/150/180150/300/380150/450/570
App/Agent Type512MB device1GB device2GB device VOIP Background Audio2025 Bluetooth16 VPN1015 Calendar Child/FileProvider Target100 CachedFileUpdater/ShareDataPackage10 Background Transfer555 WP8 Generic Background Agents WP8.1 Background Tasks Continuous Background Execution Foreground App (WP8.0 context) Foreground App (modern context) WP8 Generic Background Agents WP8.1 Background Tasks Foreground App (WP8.0 context) Foreground App (modern context)
1GB -->
Component usage (ballpark)512MB Total physical512 Paging level BSP133 OS, drivers, services300 OEM/MO service agents22 VOIP or Background audio51 Bluetooth16 VPN Foreground App, Back-stack, CBE, GBAs180 94% of apps peak at <150MB. 96% of apps average at <100MB.
App/Agent TypePriority Foreground App2 VOIP2 Background Audio2 Bluetooth2 VPN2 Background Transfer2 or 6* Calendar Child/FileProvider Target3 CachedFileUpdater/ShareDataPackage Task3 or 6* Continuous Background Execution4 Geofence-triggered Task5 WP8.0 Generic Background Agents6 WP8.1 Background Tasks6
// WP7. long totalBytes = Microsoft.Phone.Info.DeviceStatus.DeviceTotalMemory; long memUsageLimit = Microsoft.Phone.Info.DeviceStatus.ApplicationMemoryUsageLimit; long currentMemUsage = Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage; // WP8.0. ulong committedLimit = Windows.Phone.System.Memory.MemoryManager.ProcessCommittedLimit; ulong committedBytes = Windows.Phone.System.Memory.MemoryManager.ProcessCommittedBytes; // WP8.1. ulong usageLimit = Windows.System.MemoryManager.AppMemoryUsageLimit; ulong currentUsage = Windows.System.MemoryManager.AppMemoryUsage; MemoryManager.AppMemoryUsageIncreased += OnAppMemoryUsageIncreased; MemoryManager.AppMemoryUsageDecreased += OnAppMemoryUsageDecreased; private void OnAppMemoryUsageIncreased(object sender, object e) { switch (MemoryManager.AppMemoryUsageLevel) { case AppMemoryUsageLevel.High: break; case AppMemoryUsageLevel.Medium: break; case AppMemoryUsageLevel.Low: break; }
private void Init() { MemoryManager.AppMemoryUsageLimitChanging += OnAppMemoryUsageLimitChanging; } private void OnAppMemoryUsageLimitChanging( object sender, AppMemoryUsageLimitChangingEventArgs e) { Debug.WriteLine(String.Format( "AppMemoryUsageLimitChanging: old={0} MB, new={1} MB", (double)e.OldLimit / 1024 / 1024, (double)e.NewLimit / 1024 / 1024)); }
ResourceAllowed? Microphone Camera Proximity Gyro Compass Accelerometer Vibrator Push SpeechSynthesis SpeechRecognition Audio InterruptiveUI
DeviceParticipating tasksCountCapMax BGMax FG 512MBBackground transfer GBBackground transfer