title: Huawei Android devices - properly requesting permissions for background locations
body: <p>We develop an application which requires several permissions in order to get the user’s location while in the background. </p>
  
  <p>We are having problems requesting the required permissions on Huawei devices. It seems that in addition to location permission and white listing the app from battery optimizations, an additional step is required in order to disable battery optimizations and enable auto launching:</p>
  
  <p><a href="https://i.stack.imgur.com/Yb68Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yb68Q.png" alt=""></a></p>
  
  <p>The problem is we found no way of automatically requesting permission from the user, and the only way we found is having the user manually go to these screens and change the settings.</p>
  
  <p>We did find a shortcut to take us “half way”, to the application settings:</p>
  
  <pre><code>Intent intent = new
  Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
  intent.setData(Uri.parse("package:"+context.getPackageName()));
  </code></pre>
  
  <p>But multiple non intuitive actions are still required from the user.</p>
  
  <p>Our aim:</p>
  
  <ol>
  <li><p>We would very much like to make the process easier for the user. Optimally, to have a system dialog appear which asks the user for the permissions, instead of having him manually change the settings, much like the whitelisting of normal Android devices:</p>
  
  <p><a href="https://i.stack.imgur.com/V6t2Ul.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V6t2Ul.png" alt=""></a></p></li>
  </ol>
  
  <p>Is it possible using a Huawei specific SDK extension?</p>
  
  <ol start="2">
  <li>If (1) is not possible, at the very least we need a way to know if the user changes these settings or not. Currently we don’t know and cannot inform the user if the application works properly or not!</li>
  </ol>