class BarcodeScanActivity extends Activity implements Detector.Processor<Barcode> {

    @Override
    public void receiveDetections(Detector.Detections<Barcode> detections) {
        final SparseArray<Barcode> barcodeSparseArray = detections.getDetectedItems();
        if (barcodeSparseArray.size() > 0) {
            Vibrator vibrator = (Vibrator) getApplicationContext().getSystemService(VIBRATOR_SERVICE);
            assert vibrator != null;
            vibrator.vibrate(100);
            closeBarcodeActivity(barcodeSparseArray);
        }
    }

}