Table of Contents
Keyboard wedge
To you use the RFID app with a existing app that has a input field (e.g. for barcode scanning), you do not need to make any changes to your code.
Make sure to set the Output method to either Paste or Keyboard, enable the Trigger setting and assign one of the hardware keys to F7.
Broadcast
If you just want to receive the tag ID or data in your own code without any additional control, you can use a broadcast receiver.
Make sure to set the Output method to either Broadcast, enable the Trigger setting and assign one of the hardware keys to F7. Register the receiver as shown below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// Broadcast receiver to barcode data (device == 1) or tag uid (device == 2) private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals("com.handheldgroup.anysend.RESULT") == false) return; // Numeric representation of the tag type int type = intent.getIntExtra("type", -1); // String representation of the tag type String typeName = intent.getStringExtra("type_name"); // Data as byte array byte[] dataArray = intent.getByteArrayExtra("data"); // Data as String String dataString = intent.getStringExtra("string"); } }; // Register the receiver registerReceiver(receiver, new IntentFilter("com.handheldgroup.anysend.RESULT")); |
Start and stop scan
If you want to control the start and stop of a scan from your code instead (or in addition to) a hardware button, you can send broadcasts to the RFID app.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public void enableRfid() { Intent intent = new Intent("com.handheldgroup.anysend.SET_STATE"); intent.setPackage("com.handheldgroup.rfid"); intent.putExtra("device", true); sendBroadcast(intent); } public void disableRfid() { Intent intent = new Intent("com.handheldgroup.anysend.SET_STATE"); intent.setPackage("com.handheldgroup.rfid"); intent.putExtra("device", false); sendBroadcast(intent); } |
Scan activity
If you don’t want to build your own user interface for scanning, you can also directly start the scan activity provided by the app.
Setup with MaxGo Staging
When installing the app using MaxGo Staging, you can use a intent command to to apply a configuration. See here for details.
To start the RFID service during setup, create a separate intent command with the “Intent type” set to “Action” and the “Intent value” set to com.handheldgroup.rfid.START_SERVICE
.