Forum Libraries, Components, and Plugins

Andorid OnActivityResult is not fired on Xamarin Forms projec

I'am using Xamarin Forms and in the Android project to scan a card. I have given all the permissions as mentioned and added the activities. My manifest.xml is as follows
<?xml version="1.0" encoding="utf-8"?>

my code in the android project is as follows

    public string ScanCreditCard()
        var scanIntent = new Intent(this, typeof(CardIOActivity));
        string Message = "";
            scanIntent.PutExtra(CardIOActivity.ExtraAppToken, CARDIO_TOKEN);

            scanIntent.PutExtra(CardIOActivity.ExtraRequireExpiry, true);
            scanIntent.PutExtra(CardIOActivity.ExtraRequireCvv, true);
            scanIntent.PutExtra(CardIOActivity.ExtraRequirePostalCode, true);
            scanIntent.PutExtra(CardIOActivity.ExtraUseCardioLogo, false);

            StartActivityForResult(scanIntent, 101);
            Message = "Started";

        catch (Exception Ex)
            Message = Ex.Message;

            // return;

        return Message;

    protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Intent data)
        base.OnActivityResult(requestCode, resultCode, data);

        if (data != null && data.HasExtra(CardIOActivity.ExtraScanResult))
            var scanResult = data.GetParcelableExtra(CardIOActivity.ExtraScanResult).JavaCast<CreditCard>();
            CardInfo = scanResult.CardNumber;
           // CardInfo = scanResult.ScanCreditCard().IsCompleted.ToString();


OnActivityResult is not getting fired.

Sign In or Register to comment.