title: How to Detect Power Mode for Android 10 on Samsung S20 FE 5G
body: <p>I can see for this phone that I can manually choose between &quot;High Performance&quot;, &quot;Optimised&quot;, &quot;Medium Power Saving&quot;, &quot;Maximum Powers Saving&quot; under Settings-&gt;Device Care-&gt;Battery-&gt;Power Mode.</p>
  <p>However when I run the code :</p>
  <pre><code>    PowerManager powerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
      boolean powerSaveMode = powerManager.isPowerSaveMode();
      if (powerSaveMode)
          Toast.makeText(thisContext, &quot;Power Saver Mode is on&quot;, Toast.LENGTH_SHORT).show();
      else
          Toast.makeText(thisContext, &quot;Power Saver Mode is off&quot;, Toast.LENGTH_SHORT).show();
  </code></pre>
  <p>it always returns &quot;Power Save Mode is Off&quot; regardless of the setting.</p>
  <p>This code works fine on a Samsung S7 (Android 8 api 25) so I am guessing that &quot;isPowerSaveMode()&quot; is no longer the method I should be using for Q onwards.</p>
  <p>Trouble is - I cannot find any documentation that tells me what to use now.</p>
  <p>Also when I try :</p>
  <pre><code>    final String result = android.provider.Settings.System.getString(getContentResolver(), &quot;psm_switch&quot;);
      Toast.makeText(thisContext, &quot;psm_switch = &quot; + result, Toast.LENGTH_SHORT).show();
  </code></pre>
  <p>It just returns &quot;psm_switch = null&quot;</p>
  <p>Any help very gratefully received.
  Many thanks
  Tony</p>
  <p>Thanks for the link.
  We have an app that needs to track remote workers for signs of life - it records gps and accelerometer every 10 minutes.
  There are a number of settings they need to get right (as in the link you gave us) but often get wrong.
  I am attempting to add a status screen to the app which will read back to them all the settings that may cause their app to sleep or fail to collect / send gps data.
  The two main offenders are the app being power optimised and giving location permission only when the app is in use.
  General power optimising is also a candidate for problems and I am attempting to report that as well.
  However, under Android 10 there does not appear to be a detectable setting to indicate if there is any level of power saving - only a collection of about 10 other settings. (such as background location enables)</p>