Qt World Summit: Submit your Presentation

Problem with Qt Mobility 1.2 and NFC

  • I'm having a problem getting NFC to work with my copy of the Qt SDK. I am trying to get a really simple NFC app running but at the moment it's not working. If I include the "QNearFieldManager" file in my main, it detects the code and flags it in the IDE, I can get at the documentation for the class, everything. However, when I try to instantiate the class, I get "QNearFieldManager is not declared in this scope" errors. This is when I try to compile for the simulator. If I try to compile for my C7, nothing happens. I get huge numbers of warning and errors and the compiler throws a "File not found" error for QNearFieldManager. Has anyone gotten a project working yet? Can I not do this using the Qt SDK from the Nokia website? I'm running on 64 Bit Windows 7. Should I switch to Ubuntu to do my development? Can anyone point me in the right direction?


  • Hi,

    Sounds like a couple of separate issues. The first might be related to namespaces. Are you using the QTM_USE_NAMESPACE macro? The second may be due to the SDK (which version? Is it a beta?) not installing headers into the correct directory on your system.

    Are you able to paste some of your code, and the errors which are output? From just your description of the problem, it's hard to know precisely what the issue might be.


  • Well, it compiles for the simulator now. I didn't have the QTM_USE_NAMESPACE macro in place. It still won't compile for Symbian^3 however.

    Qt SDK version is 1.1.3.

    Here is the output from compile when I try to build for Symbian^3 (my Nokia C7-00)


    And here is the code for mainwindow.cpp, which includes the QNearFieldManager file. When I change the build type to Symbian^3 the IDE give the yellow underscore for "File not found" for the QNearFieldManager include.


    Here is my project file, partly based on an NFC example.


    Sorry if this is a simple question, I'm new to Qt Mobility and really want to get NFC working.

  • This is odd. It compiles when I set the Qt Version to 4.7.4 Symbian Belle. However I don't think the app is actually working: even though NFC is turned on, QNearFieldManager's isAvailable() function returns false.

  • Can you try reinstalling the Qt Mobility sis package on to your device. If Qt Mobility was installed prior to upgrading the device firmware to Symbian^3 Anna the non NFC enabled libraries would have been installed. This would explain why isAvailable() returns false.

  • I reinstalled Qt Mobility to my device, using the Qt 4.7.4 Symbian Belle SIS files that come with the Qt SDK. I also added an output to my very simple app to show what version of Qt Mobility it is using. I ran it, and isAvailable() still returns false, but I am definitely running Qt Mobility 1.2.0 now. Something definitely changed in the device: when I installed my app, it asked for access to the Connectivity section, which it didn't last time. However, still no dice. I can't get NFC to work.

  • I have recently faced the issue too. I might be a little off but here's the deal.

    The SDK update 1.1.3 added Qt Mobility 1.2 to work with QtSymbian SR1. They provided a mobility sis file for the QtSymbian 4.7.3 version.. which didn't really work too well.. the isAvailable() returning false issue has been referred to on the bug tracker and it is not resolved for the Symbian Anna release as far as i know.

    Now the solution..
    I have in the last few months made a working app with NFC scanning in the last few months targeting Symbian Anna. Just use the "Qt Mobility 1.2 Beta Addin":https://projects.developer.nokia.com/QtM12bSymb.. and instead of isAvailable().. just use the bool value from NearFieldManager::startTargetDetection().

    As for releasing your application on OVI Store, you would need to target Qt 4.7.4 and Qt Mobility 1.2.. which is part of firmware of Sybmian Belle (As i understand, Qt upgrades in future are only to be through the firmware and no longer through smart-installer) . So for your current needs use the beta addon; for release target Symbian Belle. Hope that helps.

    [ Edit: If you still have any problems setting up the addon or the implementation, let me know so I can share my solution. ]

Log in to reply