title: Android M startActivity battery optimization
body: <p>I'm developing an app that should alert an user if is near a place.
  and of course have to do that also if the phone is in idle.
  With DOZE now I understood that I have to whitelist my app, and to do that I saw that I can start an intent with the action request thanks to Buddy's answer in <a href="https://stackoverflow.com/questions/33114063/how-do-i-properly-fire-action-request-ignore-battery-optimizations-intent">this post</a> </p>
  
  <pre><code>Intent intent = new Intent();
  String packageName = context.getPackageName();
  PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
  if (pm.isIgnoringBatteryOptimizations(packageName))
      intent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
  else {
      intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
      intent.setData(Uri.parse("package:" + packageName));
  }
  context.startActivity(intent);
  </code></pre>
  
  <p>well this should be too easy...because google doesn't like this approach and if you do it, your app should be banned from the play store...no comment...
  Ok so the way should be to drive the user to the battery settings and manually add your app in the DOZE's white list...yes this should be a big wall to climb...anyway seems to be the only way...now the answer is:
  I Can use an intent to go to the power usage summary, in this way (<a href="https://stackoverflow.com/questions/3673036/create-battery-usage-intent-android">thank you Chris</a>):</p>
  
  <pre><code>Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
      ResolveInfo resolveInfo = getPackageManager().resolveActivity(powerUsageIntent, 0);
  // check that the Battery app exists on this device
      if(resolveInfo != null){
          startActivity(powerUsageIntent);
      }  
  </code></pre>
  
  <p>But how to directly go at the list of app for choosing the battery optimization?</p>
  
  <p>Thanks for any answer.  </p>