/// <summary> /// <see cref=ILabelReader.GetRawBarcodeTextFromImageAsync(object)"/> /// </summary> /// <param name="image"></param> /// <returns></returns> public override Task <string> GetRawBarcodeTextFromImageAsync(object image) { byte[] imageBytes = (byte[])image; TaskCompletionSource <string> taskCompletionSource = new TaskCompletionSource <string>(); using (Bitmap imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length)) using (global::Android.Gms.Vision.Frame frame = new global::Android.Gms.Vision.Frame.Builder().SetBitmap(imageBitmap).Build()) { SparseArray barcodeArray = BarcodeDetector.Detect(frame); if (barcodeArray.Size() <= 0) { taskCompletionSource.SetResult(String.Empty); } else { Barcode qr = (Barcode)(barcodeArray.ValueAt(0)); taskCompletionSource.SetResult(qr.RawValue); } } return(taskCompletionSource.Task); }