title: How to handle onActivityResult() with Mortar
body: <p>I am looking to integrate an application with Google Play Services and Mortar to retrieve the user's current location.</p>
  
  <p><a href="https://developer.android.com/training/location/retrieve-current.html#CheckServices" rel="nofollow">https://developer.android.com/training/location/retrieve-current.html#CheckServices</a></p>
  
  <p>This requires handling onActivityResult() in the case that Google Play Services is not available.</p>
  
  <p>My first instinct on how to do this is to make <code>getFirstScreen()</code> in <code>Main.java</code> return a blank loading screen.
  <a href="https://github.com/square/mortar/blob/master/mortar-sample/src/main/java/com/example/mortar/core/Main.java" rel="nofollow">https://github.com/square/mortar/blob/master/mortar-sample/src/main/java/com/example/mortar/core/Main.java</a> </p>
  
  <p>After injection, during <code>onCreate()</code> perform the check to see if Google Play Services is available. If it is, then call <code>flow.goTo(&lt;location using screen&gt;)</code>, if not, do nothing and wait for <code>onActivityResult()</code> to be called. Then, when <code>onActivityResult()</code> fires, simply call <code>flow.goTo(&lt;location using screen&gt;)</code>.</p>
  
  <p>The above seems slightly hacky to me. (Let me know if you need clarification). So I'm thinking the other solution might be to do something similar to this <a href="https://stackoverflow.com/questions/21927990/mortar-flow-with-third-party-libraries-hooked-to-activity-lifecycle">Mortar + Flow with third party libraries hooked to activity lifecycle</a> and hook up <code>onActivityResult()</code> to the presenter. The problem with this is that I won't have access to the <code>Activity</code> from a presenter which makes it impossible to call <code>GooglePlayServicesUtil.getErrorDialog(...)</code> because it requires <code>Activity</code>.</p>
  
  <p>I think <code>onActivityResult()</code> is very important. Perhaps it should be a part of the Mortar library?</p>