title: Android VoIP application: PARTIAL_WAKE_LOCK vs ignoring Battery Optimizations (doze whitelisting)
body: <p>I'm working on a Voice over IP (VoIP) application using the SIP protocol which requires the application to be listening to incoming calls. This means the application must not sleep or die.</p>
  
  <p>For old code, it seems the way to do this is to acquire a <a href="https://github.com/r3gis3r/CSipSimple/blob/master/src/com/csipsimple/service/SipWakeLock.java" rel="nofollow noreferrer">PARTIAL_WAKE_LOCK</a>.</p>
  
  <p>Now from Android 6.0 and higher, there's the new <a href="https://developer.android.com/training/monitoring-device-state/doze-standby.html" rel="nofollow noreferrer">Doze</a>. It is recommended that, if you don't want your app to go to standby, you should "whitelist" it by requesting the <a href="https://stackoverflow.com/a/42651399">REQUEST_IGNORE_BATTERY_OPTIMIZATIONS</a> permission. This is specifically for VoIP applications according to the <a href="https://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases" rel="nofollow noreferrer">documentation</a>. </p>
  
  <p>These two different things seem to be related. I'm not sure <strong>how they are related</strong>, if they <strong>interfere with each other</strong>, if I should <strong>use one or the other or both</strong>, and if there are <strong>other considerations</strong>. Please explain.</p>
  
  <p>Also, <em>I am not allowed to use Push Notifications</em> on this project. If you have other advice for saving the battery please let me know.</p>