"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var application = require("tns-core-modules/application");
var REQUEST_CODE = 1001;
var mrzCallback = null;
function init() {
    application.android.on(application.AndroidApplication.activityResultEvent, function (data) {
        if (mrzCallback && data.requestCode === REQUEST_CODE) {
            var result = null;
            if (data.resultCode === android.app.Activity.RESULT_OK) {
                var intent = data.intent, mrzInfo = intent.getSerializableExtra(com.mercuriete.mrz.reader.CaptureActivity.MRZ_RESULT), mrzPicturePath = intent.getExtras().getString(com.mercuriete.mrz.reader.CaptureActivity.MRZ_PICTURE_PATH);
                result = {
                    value: mrzInfo.toString(),
                    image: mrzPicturePath,
                    android: mrzInfo
                };
            }
            mrzCallback(result);
        }
    });
}
function retrieveData(callback) {
    mrzCallback = callback;
    var intent = new android.content.Intent();
    intent.setClass(application.android.context, com.mercuriete.mrz.reader.CaptureActivity.class);
    application.android.foregroundActivity
        .startActivityForResult(intent, REQUEST_CODE);
}
exports.retrieveData = retrieveData;
init();
//# sourceMappingURL=mrz-reader.android.js.map