Git Product home page Git Product logo

Comments (7)

don avatar don commented on June 26, 2024

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.

dejanmauer avatar dejanmauer commented on June 26, 2024

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:

#22 (comment)

from phonegap-nfc.

don avatar don commented on June 26, 2024

Dejan - It looks like the attachments didn't make it. Can you mail them to don at chariotsolutions dot com?

from phonegap-nfc.

dejanmauer avatar dejanmauer commented on June 26, 2024

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:

#22 (comment)

from phonegap-nfc.

don avatar don commented on June 26, 2024

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,
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:

#22 (comment)


Reply to this email directly or view it on GitHub:
#22 (comment)

from phonegap-nfc.

don avatar don commented on June 26, 2024

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.

dejanmauer avatar dejanmauer commented on June 26, 2024

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 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.


Reply to this email directly or view it on GitHub:

#22 (comment)

from phonegap-nfc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.