Skip to content

Commit

Permalink
Merge pull request #388 from pschlang/support-connect-in-reader-mode
Browse files Browse the repository at this point in the history
Allow connecting to tags discovered in readerMode
  • Loading branch information
don authored Apr 7, 2020
2 parents da3ae2f + c0d2df0 commit 0783ec0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ Connect to the tag and enable I/O operations to the tag from this TagTechnology

### Description

Function `connect` enables I/O operations to the tag from this TagTechnology object. `nfc.connect` should be called after receiving a nfcEvent from the `addTagDiscoveredListener`. Only one TagTechnology object can be connected to a Tag at a time.
Function `connect` enables I/O operations to the tag from this TagTechnology object. `nfc.connect` should be called after receiving a nfcEvent from the `addTagDiscoveredListener` or the `readerMode` callback. Only one TagTechnology object can be connected to a Tag at a time.

See Android's [TagTechnology.connect()](https://developer.android.com/reference/android/nfc/tech/TagTechnology.html#connect()) for more info.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ public void onTagDiscovered(Tag tag) {
json = Util.tagToJSON(tag);
}

Intent tagIntent = new Intent();
tagIntent.putExtra(NfcAdapter.EXTRA_TAG, tag);
setIntent(tagIntent);

PluginResult result = new PluginResult(PluginResult.Status.OK, json);
result.setKeepCallback(true);
readerModeCallback.sendPluginResult(result);
Expand Down

0 comments on commit 0783ec0

Please sign in to comment.