title: Android navigate back to Application from Android Settings
body: <p>I am having an inconsistent user experience due to the way android navigates back from Android Settings.</p>
  
  <p>In my application the user needs to give my app access to <code>ACTION_USAGE_ACCESS_SETTINGS</code>, which I access with the following: </p>
  
  <pre><code>Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  startActivity(intent);
  </code></pre>
  
  <p>After toggling the setting to on for my application, I need the user to return to my application. The only way to do this that I know of is for them to press the back button on the phone ( would love to know if it is possible to return automatically after the setting has been toggled!!!?!).</p>
  
  <p>Now one of two things will happen:</p>
  
  <p>1) The user has not used android settings recently, so it was not already open ( ie open in the open app drawer). The first press of the back button will take them to my application as desired.</p>
  
  <p>2) The user had used android settings recently. Thus settings was already open in the application drawer. Now when the user presses back, Android will take them back through each setting page they had been using recently (ie the back button takes them through their history in the android settings pages). It may take 2, 3 or 4 presses of the back button to leave Android settings, and return to my application. This is obviously terrible UI/UX, and I was wondering if there is a better way?</p>
  
  <p>I have noticed that when installing Google apps, after toggling the setting to ON, it automatically exits and returns to the application that called the setting. Being able to do that would be ideal, but I just cant work it out.</p>
  
  <p>Thanks!</p>