How to handle the result of StartActivityForResult in Forms

AntaoAlmadaAntaoAlmada Antao AlmadaPTMember ✭✭

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?

Posts

  • AntaoAlmadaAntaoAlmada Antao Almada PTMember ✭✭

    It works! Thanks a lot for the tip.

  • manishchoudharymanishchoudhary manish choudhary USMember ✭✭

    Thanks @MarkFeldman

Sign In or Register to comment.