// final String DECODE_DATA_TAG = "com.symbol.datawedge.decode_data"; public override void OnReceive(Context context, Intent intent) { String action = intent.Action; AppActivity appActivity = (AppActivity)context; if (action != null && action == (appActivity.PackageName + ".SCAN")) { String labelType = intent.GetStringExtra(LABEL_TYPE_TAG); String decodeString = intent.GetStringExtra(DATA_STRING_TAG); Snackbar.Make(appActivity.FindViewById(Resource.Id.fab), Resource.String.barcode_success + "\nType:\t" + labelType + "\nValue:\t" + decodeString, Snackbar.LengthLong).Show(); appActivity.ProcessBarcode(decodeString); } }
protected void FabOnClick(object sender, EventArgs eventArgs) { View view = (View)sender; AppActivity appActivity = (AppActivity)view.Context; Intent intent; switch (appActivity.scanTech) { case VALUE_PREF_SCAN_DATAWEDGE: // start DataWedge soft-scanning intent = new Intent(); intent.SetAction(ACTION); intent.PutExtra(SOFT_SCAN_TRIGGER, START_SCANNING); if (appActivity.FindDataWedgePackage(intent)) { appActivity.SendBroadcast(intent); } else { Snackbar.Make(view, "DataWedge is not installed.\n" + "Please select another scanning technology", Snackbar.LengthLong) .SetAction(Resource.String.action_settings, v => { Intent intent1 = new Intent(appActivity, typeof(SettingsActivity)); intent1.PutExtra(PreferenceActivity.ExtraShowFragment, // typeof(SettingsActivity.ScannerPreferenceFragment).Name "TechStoreX.SettingsActivity.ScannerPreferenceFragment"); intent1.PutExtra(PreferenceActivity.ExtraNoHeaders, true); appActivity.StartActivity(intent1); }) .Show(); } break; //case VALUE_PREF_SCAN_ZXING: // IntentIntegrator scanIntegrator = new IntentIntegrator(appActivity); // scanIntegrator.initiateScan(); // break; // case VALUE_PREF_SCAN_GOOGLEVISION: // // launch barcode capture activity // intent = new Intent(AppActivity.this, BarcodeCaptureActivity.class); // intent.putExtra(BarcodeCaptureActivity.AutoFocus, useAutoFocus); // intent.putExtra(BarcodeCaptureActivity.UseFlash, useFlash); // startActivityForResult(intent, RC_BARCODE_CAPTURE_GOOGLE_VISION); // break; case VALUE_PREF_SCAN_ZBAR_LIB: intent = new Intent(appActivity, typeof(ZBarFullScannerActivity)); appActivity.StartActivityForResult(intent, RC_BARCODE_CAPTURE_ZBAR_LIB); break; case VALUE_PREF_SCAN_ZXING_LIB: intent = new Intent(appActivity, typeof(ZXingFullScannerActivity)); appActivity.StartActivityForResult(intent, RC_BARCODE_CAPTURE_ZXING_LIB); break; case VALUE_PREF_SCAN_NONE: Snackbar.Make(view, "Please select scanning technology", Snackbar.LengthLong) .SetAction(Resource.String.action_settings, v => { Intent intent1; intent1 = new Intent(appActivity, typeof(SettingsActivity)); intent1.PutExtra(PreferenceActivity.ExtraShowFragment, typeof(SettingsActivity.ScannerPreferenceFragment).Name); intent1.PutExtra(PreferenceActivity.ExtraNoHeaders, true); appActivity.StartActivity(intent1); }) .Show(); break; } }