phonegap-nfc
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
= 0.7.0 = | ||
Add iOS support #139 | ||
Fixed language code field length detection #219 Thanks homer-jay | ||
Fixed java.util.ConcurrentModificationException #231 Thanks João Gonçalves (Chuckytuh) | ||
Documentation fixes #224 Thanks Tom Brückner (derwaldgeist) | ||
= 0.6.6 = | ||
@@ -2,0 +8,0 @@ Update Windows platforms (includes Windows Phone 8.1) |
The MIT License | ||
Copyright (c) 2011-2015 Chariot Solutions | ||
Copyright (c) 2011-2017 Chariot Solutions | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "phonegap-nfc", | ||
"version": "0.6.6", | ||
"version": "0.7.0", | ||
"description": "Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.", | ||
@@ -11,3 +11,4 @@ "cordova": { | ||
"windows", | ||
"blackberry10" | ||
"blackberry10", | ||
"ios" | ||
] | ||
@@ -27,3 +28,4 @@ }, | ||
"cordova-windows", | ||
"cordova-blackberry10" | ||
"cordova-blackberry10", | ||
"cordova-ios" | ||
], | ||
@@ -30,0 +32,0 @@ "author": "Don Coleman <don.coleman@gmail.com>", |
@@ -17,2 +17,3 @@ PhoneGap NFC Plugin | ||
* Android | ||
* [iOS 11](#ios-notes) | ||
* Windows (includes Windows Phone 8.1, Windows 8.1, Windows 10) | ||
@@ -36,2 +37,3 @@ * BlackBerry 10 | ||
* [Sample Projects](#sample-projects) | ||
* [Host Card Emulation (HCE)](#hce) | ||
* [Book](#book) | ||
@@ -63,2 +65,12 @@ * [License](#license) | ||
## iOS Notes | ||
Reading NFC NDEF tags is supported on iPhone 7 and iPhone 7 Plus running iOS 11. To enable your app to detect NFC tags, turn on the Near Field Communication Tag Reading capability in your Xcode project. Build your application with XCode 9 beta. See the [Apple Documentation](http://help.apple.com/xcode/mac/current/#/dev88ff319e7) for more info. | ||
Use [nfc.addNdefListener](#nfcaddndeflistener) to read NDEF NFC tags with iOS. Unfortunately, iOS also requires you to begin a session before scanning NFC tag. The JavaScript API contains two new iOS specific functions [nfc.beginSession](#nfcbeginsession) and [nfc.invalidateSession](#nfcinvalidatesession). | ||
You must call [nfc.beginSession](#nfcbeginsession) before every scan. | ||
The initial iOS version plugin does not support scanning multiple tags (invalidateAfterFirstRead:FALSE) or setting the alertMessage. If you have use cases or suggestions on the best way to support multi-read or alert messages, open a ticket for discussion. | ||
# NFC | ||
@@ -86,2 +98,4 @@ | ||
- [nfc.showSettings](#nfcshowsettings) | ||
- [nfc.beginSession](#nfcbeginsession) | ||
- [nfc.invalidateSession](#nfcinvalidatesession) | ||
@@ -110,5 +124,8 @@ ## nfc.addNdefListener | ||
On iOS you must call [beingSession](#nfcbeginsession) before scanning a tag. | ||
### Supported Platforms | ||
- Android | ||
- iOS | ||
- Windows | ||
@@ -134,2 +151,3 @@ - BlackBerry 7 | ||
- Android | ||
- iOS | ||
- Windows | ||
@@ -162,2 +180,4 @@ - BlackBerry 7 | ||
Note that Windows Phones need the newere NXP PN427 chipset to read non-NDEF tags. That tag will be read, but no tag meta-data is available. | ||
## nfc.removeTagDiscoveredListener | ||
@@ -210,3 +230,2 @@ | ||
- Android | ||
- Windows | ||
- BlackBerry 7 | ||
@@ -516,4 +535,52 @@ | ||
- Android | ||
- iOS | ||
- Windows | ||
## nfc.beginSession | ||
iOS requires you to begin a session before scanning a NFC tag. | ||
nfc.beginSession(success, failure); | ||
### Description | ||
Function `beginSession` starts the [NFCNDEFReaderSession](https://developer.apple.com/documentation/corenfc/nfcndefreadersession) allowing iOS to scan NFC tags. | ||
### Parameters | ||
- __success__: Success callback function called when the session begins [optional] | ||
- __failure__: Error callback function, invoked when error occurs. [optional] | ||
### Quick Example | ||
nfc.beginSession(); | ||
### Supported Platforms | ||
- iOS | ||
## nfc.invalidateSession | ||
Invalidate the NFC session. | ||
nfc.invalidateSession(success, failure); | ||
### Description | ||
Function `invalidateSession` stops the [NFCNDEFReaderSession](https://developer.apple.com/documentation/corenfc/nfcndefreadersession) returning control to your app. | ||
### Parameters | ||
- __success__: Success callback function called when the session in invalidated [optional] | ||
- __failure__: Error callback function, invoked when error occurs. [optional] | ||
### Quick Example | ||
nfc.invalidateSession(); | ||
### Supported Platforms | ||
- iOS | ||
# NDEF | ||
@@ -599,3 +666,3 @@ | ||
`id` and `serialNumber` are different names for the same value. `id` is typically displayed as a hex string `ndef.bytesToHexString(tag.id)`. | ||
`id` and `serialNumber` are different names for the same value. `id` is typically displayed as a hex string `nfc.bytesToHexString(tag.id)`. | ||
@@ -675,3 +742,3 @@ Windows, Windows Phone 8, and BlackBerry 10 read the NDEF information from a tag, but do not have access to the tag id or other meta data like capacity, read-only status or tag technologies. | ||
Only Android and BlackBerry 7 can read data from non-NDEF NFC tags. | ||
Only Android and BlackBerry 7 can read data from non-NDEF NFC tags. Newer Windows Phones with NXP PN427 chipset can read non-NDEF tags, but can not get any tag meta data. | ||
@@ -829,2 +896,7 @@ ## Mifare Classic Tags | ||
HCE | ||
======= | ||
For Host Card Emulation (HCE), try the [Cordova HCE Plugin](https://github.com/don/cordova-plugin-hce). | ||
Book | ||
@@ -842,3 +914,3 @@ ======= | ||
Copyright (c) 2011-2015 Chariot Solutions | ||
Copyright (c) 2011-2017 Chariot Solutions | ||
@@ -845,0 +917,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
@@ -488,2 +488,12 @@ /*jshint bitwise: false, camelcase: false, quotmark: false, unused: vars */ | ||
cordova.exec(win, fail, "NfcPlugin", "showSettings", []); | ||
}, | ||
// iOS only | ||
beginSession: function (win, fail) { | ||
cordova.exec(win, fail, "NfcPlugin", "beginSession", []); | ||
}, | ||
// iOS only | ||
invalidateSession: function (win, fail) { | ||
cordova.exec(win, fail, "NfcPlugin", "invalidateSession", []); | ||
} | ||
@@ -645,3 +655,3 @@ | ||
var languageCodeLength = (data[0] & 0x1F), // 5 bits | ||
var languageCodeLength = (data[0] & 0x3F), // 6 LSBs | ||
languageCode = data.slice(1, 1 + languageCodeLength), | ||
@@ -717,3 +727,3 @@ utf16 = (data[0] & 0x80) !== 0; // assuming UTF-16BE | ||
// added since WP8 must call a named function | ||
// added since WP8 must call a named function, also used by iOS | ||
// TODO consider switching NFC events from JS events to using the PG callbacks | ||
@@ -720,0 +730,0 @@ function fireNfcTagEvent(eventType, tagAsJson) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
389066
80.53%28
16.67%2227
0.36%921
8.48%