How to handle the result of StartActivityForResult in Forms

In the Android specific code of my Xamarin.Forms project, I use the following code to request the user to turn Bluetooth on:

const int RequestEnableBt = 2;
var context = Forms.Context;
var activity = (Activity)context;
var intent = new Intent(BluetoothAdapter.ActionRequestEnable);
activity.StartActivityForResult(intent, RequestEnableBt);

The user can either accept or deny the request.
In Xamarin.Android the result is handled in Activity.OnActivityResult().
Is there a way to handle this in Xamarin.Forms?


  • AntaoAlmadaAntaoAlmada PTMember ✭✭

    It works! Thanks a lot for the tip.

  • manishchoudharymanishchoudhary USMember ✭✭

    Thanks @MarkFeldman

Sign In or Register to comment.