Giter VIP home page Giter VIP logo

ti.nfc's Introduction

Titanium NFC Module

This is the cross-platform NFC Module for Titanium.

Contributors

  • Pedro Enrique
  • Jon Alter
  • Hans Knoechel

Interested in contributing? Read the contributors/committer's guide.

Legal

This module is Copyright (c) 2010-present by Appcelerator, Inc. All Rights Reserved. Usage of this module is subject to the Terms of Service agreement with Appcelerator, Inc.

ti.nfc's People

Contributors

anil-shukla-axway avatar caspahouzer avatar cb1kenobi avatar dependabot[bot] avatar ewanharris avatar garymathews avatar hansemannn avatar ingo avatar jawa9000 avatar jeffenglish avatar jonalter avatar lokeshchdhry avatar m1ga avatar sgtcoolguy avatar ssjsamir avatar ypbnv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ti.nfc's Issues

ti.nfc TagViewer example not working on Android

I am trying to run the TagViewer example on Ti.7.2.0.GA mentioned here:

https://github.com/appcelerator-modules/ti.nfc/tree/master/android/example/TagViewer/app

When the app is not open, and you scan a NFC tag, the app opens under "Nfc Service" as a separate instance, but the data does not show up.

When scanning a tag, while the app is still open, the app is simply re-opens, but again the data does not show up.

The example also mentions to use android:launchMode="singleTask" no longer works and been replaced with the feature <property name="intent-filter-new-task" type="bool">true/false</property>. See docs: https://wiki.appcelerator.org/display/guides2/Android+Intent+Filters#AndroidIntentFilters-Launchmode

Please help and update the docs, as this is an urgent feature we need to roll out soon. Many thanks!

NOTE: I also mentioned this issue on JIRA: https://jira.appcelerator.org/browse/AC-5820 as I wasen't sure where I meant to post issues.

iOS not returning NDEF messages

Saw this was an open issue at one point but I'm still not able to receive a valid response on iOS:

Creating [object TiNfcNdefMessage] in a different context than the calling function. { messages = ( "<null>" ); }

This is with "run-on-main-thread" as true. SDK 7.1.0.

Foreground Dispatch NDEF intent object has null type and action

I recently attempted to bring a 3 year old project that uses ti.nfc up to date by targeting android 33, updating to Titanium SDK 12.1.2.GA and ti.nfc 5.0.0, but ran into problems scanning NDEF tags that are readable with an old build of my project. Here is my e.inent for a read of a ISO 14443-3A NXP-Mifare Classic 1k tag (Tech: NfcA,MifareClassic,Ndef) tag:

[INFO] Intent {
[INFO] url: undefined,
[INFO] type: null,
[INFO] packageName: 'com.something.something',
[INFO] className: 'org.appcelerator.titanium.TiActivity',
[INFO] action: null,
[INFO] flags: 805306368,
[INFO] data: null,
[INFO] _hasJavaListener: undefined,
[INFO] apiName: 'Ti.Android.Intent',
[INFO] bubbleParent: true
[INFO] }

Reading the tag did fire a 'newintent' event, but onNdefDiscovered, onTagDiscovered and onTechDiscovered never caught it, even though my intentFilters never changed. Catching the intents outside of foreground dispatch worked as expected.

Trying multiple combinations of different Titanium SDKs and ti.nfc versions didn't seem to help, so I can't be certain what changed or when. BUT I did find a potential fix here: https://stackoverflow.com/questions/76655730/why-nfc-works-with-pendingintent-flag-mutable-and-not-with-pendingintent-flag-im

Changing the createPendingIntent() in NfcForegroundDispatchFilter's to be FLAG_MUTABLE instead of FLAG_IMMUTABLE, with no other changes, solved my problem and I can read NDEF tags again. The e.intent now looks like:

[INFO] Intent {
[INFO] url: undefined,
[INFO] type: 'text/plain',
[INFO] packageName: 'com.something.something',
[INFO] className: 'org.appcelerator.titanium.TiActivity',
[INFO] action: 'android.nfc.action.NDEF_DISCOVERED',
[INFO] flags: 805306368,
[INFO] data: null,
[INFO] _hasJavaListener: undefined,
[INFO] apiName: 'Ti.Android.Intent',
[INFO] bubbleParent: true
[INFO] }

To be honest, this is a little over my head and I'm not sure if this is the best fix. If anyone is interested, my super minor edit can be found in pull request #79

Problem to Read a void TAG with Android

Hi,

i can't to discovery a void tag (a new tag without record text). Could the problem be the mimetype? i search text/plain, but there isn't a text on a new tag.
I try a Tagview ad foreground.

In the first case (Tagview) I can only find a tag if it is written, in the second case (foreground) I can't find out anything.

can someone help me?

thanks
bye

Unable to get current activity

I'm porting my app from SDK 6.x to the lastest 7.x but I've encountered some problems, the app doesn't start anymore and after removing all modules and re-adding one at time I figured that ti.nfc is the problem.
The log is this one:
-- Start application log ----------------------------------------------------- [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : TiApplication: (main) [90,90] Titanium 7.1.1 (2018/04/19 11:11 undefined) [INFO] : MultiDex: VM with version 2.1.0 has multidex support [INFO] : MultiDex: install [INFO] : MultiDex: VM has multidex support, MultiDex support library is disabled. [INFO] : TiApplication: (main) [27,117] Analytics have been disabled [WARN] : TiAndroid: (main) [2470,2587] Application instance no longer available. Unable to get current activity. [WARN] : TiAndroid: (main) [2,2589] Application instance no longer available. Unable to get current activity. [WARN] : TiAndroid: (main) [0,2589] Application instance no longer available. Unable to get current activity.
The last 3 lines of WARN blocks everything and crash the app.

How do I write NdefFormatable tags?

I am trying to write chips but these are android.nfc.tech.NdefFormatable and not android.nfc.tech.Ndef and for this reason when I do the technology validation with the method tech.isValid() this returns error

App not getting records in message

Hi,

I have followed and read all the instructions. I am able to run the app in iOS and able to start the scanning. App scans the tag but when I try to read the scanned information then it shows no records on iOS - {
[INFO] : messages = (
[INFO] : {
[INFO] : }
[INFO] : );
[INFO] : }

But on android its working fine and shows the records. I tried other nfc apps on the same iPhone 7 iOS 13.3 and its reading and showing records.

What should be the problem here?

Getting runtime error, help please

I am trying to use the module, enabled NFC in identified, with new provision profile and running on iPhone XS but getting error

{“column”:23,“nativeStack”:“3 TitaniumKit0x00000001054b4644 -[TiProxy addEventListener:] + 312\n4 CoreFoundation 0x0000000185157774 4FBDF167-161A-324C-A233-D516922C67E5 + 1238900\n5 CoreFoundation 0x000000018502ad44 4FBDF167-161A-324C-A233-D516922C67E5 + 7492\n6 TitaniumKit0x00000001054b1eac -[KrollMethod call:] + 1360\n7 TitaniumKit0x00000001054b1080 __KrollCallAsFunction_block_invoke + 36\n8 TitaniumKit0x00000001054b0e90 KrollCallAsFunction + 396\n9 JavaScriptCore 0x000000018e83898c 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 3033484\n10 JavaScriptCore 0x000000018ef207e4 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 10274788\n11 JavaScriptCore 0x000000018e7a1814 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2414612\n12 JavaScriptCore 0x000000018e7a1844 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2414660\n13 JavaScriptCore 0x000000018e7a2b20 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2419488\n14 JavaScriptCore 0x000000018e7a1844 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2414660\n15 JavaScriptCore 0x000000018e7a2b20 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2419488\n16 JavaScriptCore 0x000000018e7a1844 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2414660\n17 JavaScriptCore 0x000000018e7a1844 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2414660\n18 JavaScriptCore 0x000000018e77ab58 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 2255704\n19 JavaScriptCore 0x000000018ee09c10 74545BAC-15FF-320D-A90B-8F89F75E39C1 + 9133072\n20 JavaScriptCore 0x000000018f08c40c _ZN3JSC8evaluateEPNS_14JSGlobalObjectERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 272\n21 JavaScriptCore 0x000000018e82f51c JSEvaluateScript + 696\n22 TitaniumKit0x00000001054aea60 -[KrollEval jsInvokeInContext:exception:] + 172”,“message”:“Invalid type passed to function”,“stack”:“[native code]\naddListener@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy/controllers/BaseController.js:430:23\nController@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy/controllers/login.js:270:76\nfile:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy.js:428:48\nController@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy/controllers/index.js:53:23\nfile:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy.js:428:48\nfile:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/app.js:158:23\nglobal code@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/app.js:161:70\nrequire@[native code]\nfile:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/ti.main.js:14290:10\nloadAsync@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/ti.main.js:14236:13\nglobal code@file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/ti.main.js:14287:10”,“nativeReason”:“expected: Function, was: NSNull”,“type”:“error”,“line”:430,“sourceURL”:“file:///private/var/containers/Bundle/Application/A41D4868-1CFE-4F03-B0EE-7CD895B99E48/my.app/alloy/controllers/BaseController.js”,“bubbles”:true,“source”:{},“cancelBubble”:false}
[ERROR] This device does not support NFC capabilities! (edited)

Problem with XCode10

Hi, I just updated to XCode 10 and I cannot build the app with the ti.nfc module.

I receive this error:

[ERROR] 2018-09-20 15:08:40.269 xcodebuild[6363:66947]  DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] 2018-09-20 15:08:40.269 xcodebuild[6363:66947]  DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] 2018-09-20 15:08:40.269 xcodebuild[6363:66947]  iPhoneSupport: 📱<DVTiOSDevice (0x7f91772c4700), iParnPhone, iPhone, 12.0 (16A366), 8d6f60665bb12bf99aaddf8c084449d71db4ad1a> unable to mount DeveloperDiskImage (Error Domain=com.apple.dtdevicekit Code=601 "Could not find platform" UserInfo={NSLocalizedDescription=Could not find platform})
[ERROR] 2018-09-20 15:08:40.371 xcodebuild[6363:66924] [MT] DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] 2018-09-20 15:08:40.379 xcodebuild[6363:66924] [MT] DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] 2018-09-20 15:08:40.541 xcodebuild[6363:66924] [MT] DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] 2018-09-20 15:08:40.553 xcodebuild[6363:66924] [MT] DTDeviceKit: deviceType from 7a1e1e83be69fa2a2fa48da4eed8df462fdebaff was NULL
[ERROR] ** BUILD FAILED **
[ERROR] The following build commands failed:
[ERROR]         Ld /Users/parnanzio/Sviluppo/workspace_appcelerator/myapp/build/iphone/build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp normal armv7
[ERROR] (1 failure)

If I remove the <module platform="iphone">ti.nfc</module> from tiapp.xml it compiles as always.

Android TagForeground example error

Running the stock TagForeground example on both 7.0.1 and 7.1.0 results in:

[ERROR] TiExceptionHandler: (main) [0,3844] - Message: Uncaught You must disable foreground dispatching while your activity is still resumed [ERROR] TiExceptionHandler: (main) [1,3845] - Source: nfcAdapter.disableForegroundDispatch();

This is with:

<property name="run-on-main-thread" type="bool">true</property>

Building App with ti.nfc on Ti 7.1.0

Running on Ti 7.1.0.GA
Mac OSX
Installed Module locally in project (and tried globally)
Test on Simulator iPhone X (OS 11.3)

Error on Building:

[INFO] :   Invoking xcodebuild
[ERROR] :  ** BUILD FAILED **
[ERROR] :  The following build commands failed:
[ERROR] :  	Ld build/Products/Debug-iphonesimulator/NFCTest.app/NFCTest normal x86_64
[ERROR] :  (1 failure)

Incidentally, I tried also with Ti 7.0.2

part of my tiapp.xml:

<property name="run-on-main-thread" type="bool">true</property>
    <ios>
        <enable-launch-screen-storyboard>false</enable-launch-screen-storyboard>
        <use-app-thinning>true</use-app-thinning>
        <entitlements>
            <dict>
                <key>com.apple.developer.nfc.readersession.formats</key>
                <array>
                    <string>NDEF</string>
                </array>
            </dict>
        </entitlements>
        <plist>
            <dict>
                <key>NFCReaderUsageDescription</key>
                <string>n.b. some privacy info goes here</string>

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.