Comments (7)
I can't duplicate this. I'm using phonegap-nfc-0.4.0, cordova-1.6.1, sdk-version 15, samsung galaxy nexus (GSM).
Can you send me some info about your setup so I can duplicate this? Can you post or email me the intent from your manifest and the log file from adb logcat?
Android Manifest
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="text/pg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
adb logcat
D/CordovaLog(10781): Viewport argument value "320;" for key "width" was truncated to its numeric prefix.
D/CordovaLog(10781): file:///android_asset/www/index.html: Line 4 : Viewport argument value "320;" for key "width" was truncated to its numeric prefix.
V/Web Console(10781): Viewport argument value "320;" for key "width" was truncated to its numeric prefix. at file:///android_asset/www/index.html:4
D/SoftKeyboardDetect(10781): Ignore this event
I/ActivityManager( 192): Displayed com.chariotsolutions.nfc.demo.reader/.ReaderDemo: +215ms (total +224ms)
D/OpenGLRenderer( 423): Flushing caches (mode 0)
D/NfcPlugin(10781): execute init
D/NfcPlugin(10781): Enabling plugin Intent { act=android.nfc.action.NDEF_DISCOVERED typ=text/pg cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo (has extras) }
D/NfcPlugin(10781): parseMessage Intent { act=android.nfc.action.NDEF_DISCOVERED typ=text/pg cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo (has extras) }
D/NfcPlugin(10781): action android.nfc.action.NDEF_DISCOVERED
D/CordovaLog(10781): Error: Status=2 Message=Class not found
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js: Line 908 : Error: Status=2 Message=Class not found
I/Web Console(10781): Error: Status=2 Message=Class not found at file:///android_asset/www/cordova-1.6.1.js:908
D/CordovaLog(10781): Error initializing Network Connection: Class not found
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js: Line 4634 : Error initializing Network Connection: Class not found
I/Web Console(10781): Error initializing Network Connection: Class not found at file:///android_asset/www/cordova-1.6.1.js:4634
V/NfcPlugin(10781): var e = document.createEvent('Events');
V/NfcPlugin(10781): e.initEvent('ndef-mime');
V/NfcPlugin(10781): e.tag = {"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC Forum Type 2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]};
V/NfcPlugin(10781): document.dispatchEvent(e);
D/NfcPlugin(10781): execute registerMimeType
D/chromium(10781): Unknown chromium error: -400
D/CordovaLog(10781): JSCallback Error: Request failed.
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js: Line 3557 : JSCallback Error: Request failed.
I/Web Console(10781): JSCallback Error: Request failed. at file:///android_asset/www/cordova-1.6.1.js:3557
D/CordovaLog(10781): {"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC Forum Type 2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]}
D/CordovaLog(10781): file:///android_asset/www/main.js: Line 59 : {"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC Forum Type 2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]}
I/Web Console(10781): {"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC Forum Type 2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]} at file:///android_asset/www/main.js:59
D/CordovaLog(10781): Initialized the NfcPlugin
D/CordovaLog(10781): file:///android_asset/www/phonegap-nfc-0.4.0.js: Line 7 : Initialized the NfcPlugin
I/Web Console(10781): Initialized the NfcPlugin at file:///android_asset/www/phonegap-nfc-0.4.0.js:7
D/CordovaLog(10781): Listening for NDEF tags.
D/CordovaLog(10781): file:///android_asset/www/main.js: Line 123 : Listening for NDEF tags.
I/Web Console(10781): Listening for NDEF tags. at file:///android_asset/www/main.js:123
from phonegap-nfc.
Hi,
I am useing phonegap-nfc-0.4.0 and PhoneGap 1.7.0 (I have tried also on
PhoneGap 1.6.1, but later upgraded project because of the issue).
My phone is Samsung Galaxy Nexus (GSM) and the project is build upon
sdk-version 14 (since my phone works only with v.14).
I have attached project folder where you can find manifest file.
CatLog from my phone is also attached. First I have put NFC card to the
phone and application showed up, but did not triger onNFC event, so no card
information were displayed. I removed the card and left application open.
After a second I have put the same card to the phone again and the
information from the card was displayed.
I hope this will help you evaluate issue.
Thank you for your quick support. I really like your work!
Best regards,
Dejan
On Wed, Jun 6, 2012 at 3:59 PM, Don Coleman <
[email protected]
wrote:
I can't duplicate this. I'm using phonegap-nfc-0.4.0, cordova-1.6.1,
sdk-version 15, samsung galaxy nexus (GSM).Can you send me some info about your setup so I can duplicate this? Can
you post or email me the intent from your manifest and the log file from
adb logcat?Android Manifest
<intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <data android:mimeType="text/pg" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
adb logcat
D/CordovaLog(10781): Viewport argument value "320;" for key "width"
was truncated to its numeric prefix.
D/CordovaLog(10781): file:///android_asset/www/index.html: Line 4 :
Viewport argument value "320;" for key "width" was truncated to its numeric
prefix.
V/Web Console(10781): Viewport argument value "320;" for key
"width" was truncated to its numeric prefix. at
file:///android_asset/www/index.html:4
D/SoftKeyboardDetect(10781): Ignore this event
I/ActivityManager( 192): Displayed
com.chariotsolutions.nfc.demo.reader/.ReaderDemo: +215ms (total +224ms)
D/OpenGLRenderer( 423): Flushing caches (mode 0)
D/NfcPlugin(10781): execute init
D/NfcPlugin(10781): Enabling plugin Intent {
act=android.nfc.action.NDEF_DISCOVERED typ=text/pg
cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo (has extras) }
D/NfcPlugin(10781): parseMessage Intent {
act=android.nfc.action.NDEF_DISCOVERED typ=text/pg
cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo (has extras) }
D/NfcPlugin(10781): action android.nfc.action.NDEF_DISCOVERED
D/CordovaLog(10781): Error: Status=2 Message=Class not found
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js:
Line 908 : Error: Status=2 Message=Class not found
I/Web Console(10781): Error: Status=2 Message=Class not found at
file:///android_asset/www/cordova-1.6.1.js:908
D/CordovaLog(10781): Error initializing Network Connection: Class
not found
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js:
Line 4634 : Error initializing Network Connection: Class not found
I/Web Console(10781): Error initializing Network Connection: Class
not found at file:///android_asset/www/cordova-1.6.1.js:4634
V/NfcPlugin(10781): var e = document.createEvent('Events');
V/NfcPlugin(10781): e.initEvent('ndef-mime');
V/NfcPlugin(10781): e.tag =
{"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC
Forum Type
2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]};
V/NfcPlugin(10781): document.dispatchEvent(e);
D/NfcPlugin(10781): execute registerMimeType
D/chromium(10781): Unknown chromium error: -400
D/CordovaLog(10781): JSCallback Error: Request failed.
D/CordovaLog(10781): file:///android_asset/www/cordova-1.6.1.js:
Line 3557 : JSCallback Error: Request failed.
I/Web Console(10781): JSCallback Error: Request failed. at
file:///android_asset/www/cordova-1.6.1.js:3557
D/CordovaLog(10781):
{"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC
Forum Type
2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]}
D/CordovaLog(10781): file:///android_asset/www/main.js: Line 59 :
{"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC
Forum Type
2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]}
I/Web Console(10781):
{"isWritable":true,"id":[4,-53,-111,26,67,40,-128],"techTypes":["android.nfc.tech.MifareUltralight","android.nfc.tech.NfcA","android.nfc.tech.Ndef"],"type":"NFC
Forum Type
2","canMakeReadOnly":true,"maxSize":137,"ndefMessage":[{"id":[],"type":[116,101,120,116,47,112,103],"payload":[72,101,108,108,111,32,80,104,111,110,101,71,97,112],"tnf":2}]}
at file:///android_asset/www/main.js:59
D/CordovaLog(10781): Initialized the NfcPlugin
D/CordovaLog(10781):
file:///android_asset/www/phonegap-nfc-0.4.0.js: Line 7 : Initialized the
NfcPlugin
I/Web Console(10781): Initialized the NfcPlugin at
file:///android_asset/www/phonegap-nfc-0.4.0.js:7
D/CordovaLog(10781): Listening for NDEF tags.
D/CordovaLog(10781): file:///android_asset/www/main.js: Line 123 :
Listening for NDEF tags.
I/Web Console(10781): Listening for NDEF tags. at
file:///android_asset/www/main.js:123
Reply to this email directly or view it on GitHub:
from phonegap-nfc.
Dejan - It looks like the attachments didn't make it. Can you mail them to don at chariotsolutions dot com?
from phonegap-nfc.
Hi,
I put it on Dropbox : https://dl.dropbox.com/u/72440/nfc.zip
regards,
Dejan
On Wed, Jun 6, 2012 at 4:59 PM, Don Coleman <
[email protected]
wrote:
Dejan - It looks like the attachments didn't make it. Can you mail them
to don at chariotsolutions dot com?
Reply to this email directly or view it on GitHub:
from phonegap-nfc.
Got it. I'll take a look later today.
On Wed, Jun 6, 2012 at 11:02 AM, dejanmauer
[email protected]
wrote:
Hi,
I put it on Dropbox : https://dl.dropbox.com/u/72440/nfc.zip
regards,
DejanOn Wed, Jun 6, 2012 at 4:59 PM, Don Coleman <
[email protected]wrote:
Dejan - It looks like the attachments didn't make it. Β Can you mail them
to don at chariotsolutions dot com?
Reply to this email directly or view it on GitHub:
Reply to this email directly or view it on GitHub:
#22 (comment)
from phonegap-nfc.
Here's what's happening:
Your intent filter in the manifest has a mime-type
, so an ndef-mime
event is begin dispatched from phonegap-nfc.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Your code is listening for ndef
events, so it ignores the ndef-mime
event that launches the app.
nfc.addNdefListener(onNFC, win, fail);
You can use the same onNFC
listener to handle ndef-mime
events.
nfc.addMimeTypeListener("text/plain", onNFC, win, fail);
You can keep both the ndefListener
and the mimeTypeListener
, however once the mimeTypeListener
is added you won't see ndef
events for plain text tags. Android uses the most specific intent filter when scanning. Also it appears that android treats tags that are TNF WELL_KNOWN RTD type TEXT the same as TNF MIME_MEDIA type "text/plain".
You could switch your code to only have the mimeTypeListener if you don't want it to scan other ndef tags.
Are you creating the NFC tags? You might consider using your own unique mime type "text/centsi", so that your application scans your tags and other applications ignore your tags.
from phonegap-nfc.
Thank you very much for the explanation and help me solve my issue.
Have a nice day,
Dejan
On Wed, Jun 6, 2012 at 9:16 PM, Don Coleman <
[email protected]
wrote:
Here's what's happening:
Your intent filter in the manifest has a
mime-type
, so anndef-mime
event is begin dispatched from phonegap-nfc.<intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <data android:mimeType="text/plain" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
Your code is listening for
ndef
events, so it ignores thendef-mime
event that launches the app.nfc.addNdefListener(onNFC, win, fail);
You can use the same
onNFC
listener to handlendef-mime
events.nfc.addMimeTypeListener("text/plain", onNFC, win, fail);
You can keep both the
ndefListener
and themimeTypeListener
, however
once themimeTypeListener
is added you won't seendef
events for plain
text tags. Android uses the most specific intent filter when scanning.
Also it appears that android treats tags that are TNF WELL_KNOWN RTD type
TEXT the same as TNF MIME_MEDIA type "text/plain".You could switch your code to only have the mimeTypeListener if you don't
want it to scan other ndef tags.Are you creating the NFC tags? You might consider using your own unique
mime type "text/centsi", so that your application scans your tags and other
applications ignore your tags.
Reply to this email directly or view it on GitHub:
from phonegap-nfc.
Related Issues (20)
- Is there a way to hide/disable the native iOS NFC reading dialogs?
- Does this plugin works in iOS 15.2?
- NFC reader
- Android 12 - Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent HOT 25
- Build failed when installing a Plugin in Phonegap (NFC)
- Support for ISO18092 tags in iOS
- Writing NFC Tag didn't succeeded every time in Quasar Cordova mobile App
- android NFC Card HOT 1
- NFC scanning not working IOS HOT 7
- SerialNumber not being retrieved on iOS HOT 1
- Android 12 SDK not fire scan event HOT 3
- Ionic NFC on Android 12 Crushing the App HOT 8
- Ionic Android 13 makeReadOnly java.io.IOException HOT 3
- Does not work with Xcode 14.3 and iOS 16.4 HOT 1
- Does this plugin support BAC ( Basic Access Control ) to read NFC Chip on ePassport ? HOT 1
- NFC Writting Error - Only one tag technology can be connected at a time HOT 6
- Ionic capacitor targetsdk 33 app crash with plugin is installed without nfc plugin work works ok HOT 28
- On ios while reading tag give error 203. "System resources unavailable HOT 7
- NFC Tag Writing Issue HOT 1
- The first two Characters are getting trimmed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phonegap-nfc.