shouldRestrictTracking property

bool get shouldRestrictTracking

Whether tracking should be restricted due to power state.

Returns true if:

  • Battery is critical and not charging
  • Device is in Doze mode and not exempt
  • Power save mode is active

Implementation

bool get shouldRestrictTracking {
  if (isCharging) return false;
  if (isCriticalBattery) return true;
  if (isDozeMode && !isBatteryOptimizationExempt) return true;
  return isPowerSaveMode;
}