title: Can I pass a ResolvableApiException to a new activity?
body: <p>I am using Google Play Services to get a user's location (package <code>com.google.android.gms:play-services-location:16.0.0</code>). As described <a href="https://developer.android.com/training/location/change-location-settings" rel="nofollow noreferrer">here</a>, you can prompt the user to turn on location settings if necessary via a dialog that is launched using <code>startResolutionForResult</code>:</p>
  
  <pre><code>task.addOnFailureListener(this, new OnFailureListener() {
  @Override
  public void onFailure(@NonNull Exception e) {
      if (e instanceof ResolvableApiException) {
          try {
              ResolvableApiException resolvable = (ResolvableApiException) e;
              resolvable.startResolutionForResult(MainActivity.this, REQUEST_CHECK_SETTINGS);
          } catch (IntentSender.SendIntentException sendEx) {
              // Ignore the error.
          }
      }
  }
  </code></pre>
  
  <p>However, I would like to launch this dialog in a new activity started by tapping a notification. To do so, I am trying to add the <code>ResolvableApiException resolvable</code> to the intent for the new activity so I can call <code>startResolutionForResult</code> inside the new activity class. Specifically, I have:</p>
  
  <pre><code>final Intent intent = new Intent(context, NewActivity.class);
  final Bundle extras = new Bundle();
  extras.putSerializable(EXTRA_EXCEPTION, resolvable);
  intent.putExtras(extras);
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.google.android.gms.common.api.ResolvableApiException)
  Caused by: java.io.NotSerializableException: com.google.android.gms.common.api.Status
  </code></pre>
  
  <p><code>ResolvableApiException</code> ultimately inherits from <code>Throwable</code>, which implements <code>Serializable</code>, so I was hoping I could add <code>resolvable</code> as a serializable extra. But it seems that <code>ResolvableApiException</code>'s <code>Status</code> field is not serializable.</p>
  
  <p>Any suggestions on how I can make this approach work or another approach I can use to trigger the dialog via tapping a notification? Thanks!</p>