"Write to me for a jar of chips a barcode reader for android, just to write the results in the files and the time, my brother needs."Out of interest, I ran through ready-made solutions in js and android, and since. I have a xiaomi smartphone with a ready-made scanner application, I thought, why not try to just take the scan results from it? Ok, I tried to google info about intents or ready-made instructions for getting data from the scanner, but in vain. It was decided to scan the application manifest for intents.In the end, it turned out to be not a brother, and it was not necessary, and in general a can of chips is expensive
- Find and pick up the APK from the phone.
adb shell ~:/pm list packages | grep scanner ~:/pm path com.xiaomi.scanner exit pull /system/priv-app/MiuiScanner/MiuiScanner.apk
- We decompile apk using an online service .
- Examining the manifest. Find the first action that comes across.
AndroidManifest.xml
- Create a new android project and write a scanner call.
val intent = Intent("miui.intent.action.scanbarcode") startActivityForResult(intent, 1);
- , … , , ? , . .
ScanActivity.java
.
- , EXTRA_INTENT_IS_BACKTO_THIRDAPP isBackToThirdApp.
AppUtils.java
- .
val intent = Intent("miui.intent.action.scanbarcode") intent.putExtra("isBackToThirdApp",true) startActivityForResult(intent, 1);
- .
super.onActivityResult(requestCode, resultCode, data) if (resultCode==Activity.RESULT_OK){ result.setText(data?.extras?.getString("result")) }
- .
- , Xiaomi
,