{"id":22127281,"url":"https://github.com/valentiniljaz/cordova-nfcv-plugin","last_synced_at":"2025-07-25T17:31:27.011Z","repository":{"id":57207616,"uuid":"87178901","full_name":"valentiniljaz/cordova-nfcv-plugin","owner":"valentiniljaz","description":"Cordova plugin for reading and writing to NFC tags using NfcV protocol (with support for Ionic2)","archived":false,"fork":false,"pushed_at":"2022-12-06T07:02:11.000Z","size":967,"stargazers_count":14,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-30T01:03:02.223Z","etag":null,"topics":["android","angular2","cordova","ionic2","java","nfc","nfcv"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valentiniljaz.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-04T11:31:43.000Z","updated_at":"2023-12-28T04:37:36.000Z","dependencies_parsed_at":"2023-01-24T08:46:21.813Z","dependency_job_id":null,"html_url":"https://github.com/valentiniljaz/cordova-nfcv-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentiniljaz%2Fcordova-nfcv-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentiniljaz%2Fcordova-nfcv-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentiniljaz%2Fcordova-nfcv-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentiniljaz%2Fcordova-nfcv-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valentiniljaz","download_url":"https://codeload.github.com/valentiniljaz/cordova-nfcv-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227553557,"owners_count":17786124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","angular2","cordova","ionic2","java","nfc","nfcv"],"created_at":"2024-12-01T17:17:44.194Z","updated_at":"2024-12-01T17:17:45.162Z","avatar_url":"https://github.com/valentiniljaz.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cordova-nfcv-plugin\n\nCordova plugin for reading and writing to NFC tags using NfcV protocol (with support for Ionic2+)\n\nInstallation:\n----------------------------------------------------\n\nRequirements: Make sure you have a working environment for Ionic2+ project or for Cordova project before installing \nthe plugin.\n\nIonic2+:\n\n`ionic plugin add https://github.com/valentiniljaz/cordova-nfcv-plugin`\n\nCordova (without Ionic2+)\n\n`cordova plugin add https://github.com/valentiniljaz/cordova-nfcv-plugin`\n\nConfiguration:\n----------------------------------------------------\nPlugin configuration is done by changing values in NfcVHandler class (`src/android/NfcVHandler.java`).\n\nSome NFC tags might not support NDEF:\n\n* READ_NDEF: Prevent reading NDEF if tag does not support it.\n* NDEF_BLOCK_ADDR: Address of the first block that contains NDEF message encoded with TLV (T = type; L = length; V = value). See attached datasheet 02 (chapters: 3.2 and 4.1) for more info.\n\nThe following values should be the same for any tag. If not, you should change to the appropriate values:\n\n* CMD_READ: Code for read command (default: 0x20).\n* CMD_WRITE: Code for write command (default: 0x21).\n* CMD_FLAGS: Each request specifies some flags (default: 0x02 - High data rate). See attached datasheet 01 (chapter: 19.1) for more info.\n\n\nUsage:\n----------------------------------------------------\n\n#### `NfcV.init: function (success, error));`\n\nInitializes plugin. In most cases not even required, since every request also initializes the adapter.\n\n* success - Function returns \"NFC_INIT_OK\"\n* error - Check error flags below\n\n\n#### `NfcV.checkNfcVAvailability: function (success, error));`\n\nCheck if Nfc hardware is available.\n\n* success - Function returns \"NFC_CHECK_OK\"\n* error - Check error flags below\n\n#### `NfcV.addNdefListener: function (success, error));`\n\nGet notified when ever new device is discovered. Ndef message is sent in event data.\n\n* success - If listener added it returns \"NDEF_LISTENER_ADDED\"\n* error - Check error flags below\n\nYou need to add `document.addEventListener` to be notified when a new device is discovered.\n\n```\ndocument.addEventListener('NdefTag', (event) =\u003e {\n    console.log('Ndef', JSON.parse(event.ndef));\n}, true);\n\nNfcV.addNdefListener();\n```\n\n#### `NfcV.startListening: function (success, error));`\n\nStarts listening for new \"ACTION_TECH_DISCOVERED\" intent.\n\n* success - When intent recieved it returns \"NFC_INTENT_ACTIVE\"\n* error - Check error flags below\n\n\n#### `NfcV.stopListening: function (success, error));`\n\nIt disables foreground dispatch. Intents are no longer received.\n\n* success - It returns \"NFC_STOP\"\n* error - Check error flags below\n\n#### `NfcV.transceive: function (request, success, error));`\n\nIt is used to dispatch any kind of request against a NFC tag. Request object has to include a full request: flags, block_addr and any data.\n\n* success - It returns response from the request. If it is a read request it returns the read data. If it is a write request it returns write response.\n* error - Check error flags below\n\n\n#### `NfcV.readBlock: function (blockAddr, success, error));`\n\nReads one block from `blockAddr`.\n\n* success - It returns bytes read from block at `blockAddr` along with response flags\n* error - Check error flags below\n\n\n#### `NfcV.writeBlock: function (blockAddr, blockData, success, error));`\n\nWrites `blockData` into one block at `blockAddr`.\n\n* success - It returns bytes from write response (error flag and any error code)\n* error - Check error flags below\n\n\n#### ERRORs\n\n* `E_NO_NFC` - NFC is not supported\n* `E_NFC_DISABLED` - NFC is not enabled\n* `E_NULL_TAG` - Tag returned NULL\n* `E_ADDR_TOO_LONG` - Block addr is too long (more than 2 bytes)\n\n#### Datasheets\n\n* Datasheet 01: Specs for M24LR04E-R (01__Specs__M24LR04E-R)\n\t- chapters: 19, 20, 26\n* Datasheet 02: Using M24LR04E-R (02__Using__M24LR04E-R)\n\t- chapters: 3, 4\n\n#### AndroidManifest.xml\n\nAdd the following intent filters inside `activity`:\n\n```\n\u003cintent-filter\u003e\n    \u003caction android:name=\"android.nfc.action.NDEF_DISCOVERED\" /\u003e\n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n    \u003cdata android:mimeType=\"text/plain\" /\u003e\n\u003c/intent-filter\u003e\n\u003cintent-filter\u003e\n    \u003caction android:name=\"android.nfc.action.TECH_DISCOVERED\" /\u003e\n\u003c/intent-filter\u003e\n\u003cmeta-data android:name=\"android.nfc.action.TECH_DISCOVERED\" android:resource=\"@xml/nfc_tech_filter\" /\u003e\n```\n### nfc_tech_filter\n\nCreate new file within `platforms/android/res/xml/nfc_tech_filter.xml`:\n\n```\n\u003cresources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\"\u003e\n    \u003ctech-list\u003e\n        \u003ctech\u003eandroid.nfc.tech.NfcV\u003c/tech\u003e\n    \u003c/tech-list\u003e\n\u003c/resources\u003e\n```\n\nIonic2+ service: NfcvService\n----------------------------------------------------\n\n[More about Ionic2+ support ...](./ionic2/readme.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentiniljaz%2Fcordova-nfcv-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentiniljaz%2Fcordova-nfcv-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentiniljaz%2Fcordova-nfcv-plugin/lists"}