title: Android check is bluetooth in doze mode
body: <p>Good day. 
  I would like to know if the bluetooth scanning is unavailable now (locked by doze mode?).</p>
  
  <p>Now i check it by this method:</p>
  
  <pre><code>fun isInDozeMode(context: Context) : Boolean {
      val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
      return Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M &amp;&amp; powerManager.isDeviceIdleMode
  }
  </code></pre>
  
  <p>But this method returns true even if i receive bluetooth (iBeacon) event just now.</p>