Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [QtSystemInfo] [QDeviceInfo] can't use this on Android

    Mobile and Embedded
    4
    14
    5933
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FrankiPL last edited by

      Hi All,

      I was using QSystemDeviceInfo to get IMEI from my phone on qt4, now I'm switching to qt5, so as I read I need QDeviceInfo from add-on module https://qt.gitorious.org/qt/qtsystems.

      I have cloned this with git and compiled/installed using gcc qmake, it went fine.

      However, I can't do it with android qmake, it fails when I want to install this.
      So my app is not compiling, I have copied include files into
      5.3/android_armv7/include/QtSystemInfo/
      So I can include QDeviceInfo in project files, but obviously application fails during linking procedure with:
      error: undefined reference to 'QDeviceInfo::QDeviceInfo(QObject*)

      Below is what I'm doing to compile QtSystemInfo for android, qt 5.3, what am I doing wrong ?

      cd Qt/5.3/Src
      franki@franki:~/Qt/5.3/Src$ git clone git://qt.gitorious.org/qt/qtsystems.git
      Cloning into 'qtsystems'...
      remote: Counting objects: 8762, done.
      remote: Compressing objects: 100% (2813/2813), done.
      remote: Total 8762 (delta 6521), reused 7798 (delta 5837)
      Receiving objects: 100% (8762/8762), 2.66 MiB | 1.13 MiB/s, done.
      Resolving deltas: 100% (6521/6521), done.
      franki@franki:~/Qt/5.3/Src$ cd qtsystems
      franki@franki:~/Qt/5.3/Src/qtsystems$ export ANDROID_NDK_ROOT=/home/franki/AndroidNDK/android-ndk-r10/
      franki@franki:~/Qt/5.3/Src/qtsystems$ export ANDROID_SDK_ROOT=/home/franki/AndroidSDK/android-sdk-linux/
      franki@franki:~/Qt/5.3/Src/qtsystems$ ../../android_armv7/bin/qmake
      franki@franki:~/Qt/5.3/Src/qtsystems$
      franki@franki:~/Qt/5.3/Src/qtsystems$ make
      /home/franki/AndroidNDK/android-ndk-r10//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/franki/AndroidNDK/android-ndk-r10//platforms/android-9/arch-arm/ -Wl,-soname,libqtsystems.so -Wl,-rpath=/home/franki/Qt/5.3/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libqtsystems.so -L/home/franki/AndroidNDK/android-ndk-r10//sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -L/home/franki/AndroidNDK/android-ndk-r10//platforms/android-9/arch-arm//usr/lib -L/home/franki/Qt/5.3/android_armv7/lib -lQt5Gui -L/opt/android/ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -L/opt/android/ndk/platforms/android-9/arch-arm//usr/lib -lQt5Core -lGLESv2 -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
      franki@franki:~/Qt/5.3/Src/qtsystems$
      franki@franki:~/Qt/5.3/Src/qtsystems$ make install
      mkdir: can't create dir `/libs': Access denied
      make: *** [install_target] Error 1
      franki@franki:~/Qt/5.3/Src/qtsystems$

      I know that I'm doing this not as a root, but installing libqtsystems.so in my Linux /libs directory won't solve my android problem?

      best regards
      Franki

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        IIRC, currently it's not implemented for iOS, android and blackberry

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • F
          FrankiPL last edited by

          Hi,

          There is a thread on this forum where someone asks about getting IMEI/IMSI from phone and they suggest him using QtSystems module (for Sailfish OS)
          http://qt-project.org/forums/viewthread/33785

          Should I use older qt than 5.3.1 like 5.2 or something ? I think it's quite impossible that this modules is not implemented for android in all qt5 branch ?

          All the best
          Marek

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            What OS was your phone running ? And how where you getting the IEMI ?

            SailfishOS is another beast.

            It has just not yet been implemented

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • F
              FrankiPL last edited by

              Hi,

              Sorry for late answer.
              I'm running Android 4.1, I'm developing on Linux.
              Getting IMEI is pretty straightforward:
              @
              sysInfo=new QDeviceInfo(this);
              qDebug()<<"NetManager::NetManager imei:"<<sysInfo->imei(0)
              @

              If you know any other way to get unique phone id or sim card id, please tell me.

              best regards
              Marek

              1 Reply Last reply Reply Quote 0
              • metaDom
                metaDom last edited by

                Could you explain how to build the addon module on windows?

                thanks in advance

                @C:\Qt\5.3\Src\qt-qtsystems>qmake
                Info: creating cache file C:\Qt\5.3\Src\qt-qtsystems.qmake.cache
                Checking for gconf... no
                Checking for bluez... no
                Checking for udev... no
                Checking for x11... no

                C:\Qt\5.3\Src\qt-qtsystems>make
                Makefile:162: *** multiple target patterns. Stop.@

                Line 162:

                @Makefile: qtsystems.pro .qmake.conf .qmake.cache C:/Qt/5.3/mingw482_32/mkspecs/win32-g++/qmake.conf C:/Qt/5.3/mingw482_32/mkspecs/features/spec_pre.prf @

                1 Reply Last reply Reply Quote 0
                • F
                  FrankiPL last edited by

                  On windows, I don't know. I'm developing on Linux and it was easy:

                  franki@franki:~/Qt/5.3/Src/qtsystems$ ../../gcc_64/bin/qmake
                  franki@franki:~/Qt/5.3/Src/qtsystems$ make
                  franki@franki:~/Qt/5.3/Src/qtsystems$ make install

                  1 Reply Last reply Reply Quote 0
                  • metaDom
                    metaDom last edited by

                    hmm too bad, anyone else got a successful compilation on windows?

                    1 Reply Last reply Reply Quote 0
                    • M
                      mr_wallyit last edited by

                      Hello,

                      I tried with Qt 5.3.0 but is doesn't work, I have a lot of error when it compile.

                      1 Reply Last reply Reply Quote 0
                      • SGaist
                        SGaist Lifetime Qt Champion last edited by

                        What OS ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply Reply Quote 0
                        • M
                          mr_wallyit last edited by

                          Hello,

                          I use Windows 8.1 (Italian version) with Qt creator 3.1.1 and Qt 5.3.0 (MingW32)

                          1 Reply Last reply Reply Quote 0
                          • SGaist
                            SGaist Lifetime Qt Champion last edited by

                            What error message are you getting ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply Reply Quote 0
                            • M
                              mr_wallyit last edited by

                              Hello,
                              this is step by step:

                              I copied qt-qtsystems in C:\Qt\Qt5.3.0\Examples\Qt-5.3

                              run QtCreator and open the “ qtsystems.pro” project file

                              get to “Projects->(Your Kit)->Build->Build Steps”

                              add a new make “Build Step” and write to the “Make arguments” the install target

                              from the menus, select “Rebuild Project qtserialport”

                              Path desn't found
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/imports/publishsubscribe/publishsubscribe.pro. Giving up.
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/imports/serviceframework/serviceframework.pro. Giving up.
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/imports/systeminfo/systeminfo.pro. Giving up.
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/publishsubscribe/publishsubscribe.pro. Giving up.
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/serviceframework/serviceframework.pro. Giving up.
                              Error while parsing file C:/Qt/Qt5.3.0/Examples/Qt-5.3/qt-qtsystems/src/systeminfo/systeminfo.pro. Giving up.
                              Project ERROR: Project has no top-level .qmake.conf file.
                              Project ERROR: Project has no top-level .qmake.conf file.
                              Project ERROR: Project has no top-level .qmake.conf file.
                              Project WARNING: You should probably load(qt_build_config) first in publishsubscribe.pro for QtPublishSubscribe, as the latter also load()s qt_module.
                              Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/linker options in your .pro file.
                              Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you know what you are doing.
                              Project ERROR: Module does not define version.
                              Project WARNING: You should probably load(qt_build_config) first in serviceframework.pro for QtServiceFramework, as the latter also load()s qt_module.
                              Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/linker options in your .pro file.
                              Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you know what you are doing.
                              Project ERROR: Module does not define version.
                              Project WARNING: You should probably load(qt_build_config) first in systeminfo.pro for QtSystemInfo, as the latter also load()s qt_module.
                              Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/linker options in your .pro file.
                              Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you know what you are doing.
                              Project ERROR: Module does not define version.
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: publishsubscribe
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework-private serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework-private serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework-private serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework-private serviceframework
                              Project ERROR: Unknown module(s) in QT: serviceframework
                              Project ERROR: Unknown module(s) in QT: systeminfo
                              Project ERROR: Unknown module(s) in QT: systeminfo
                              Project ERROR: Unknown module(s) in QT: systeminfo

                              When i build the project I don't have error, but the In the my project Android
                              I have this Error:

                              C:\Users\pc\qt-project\Booking\main.cpp:50: error: 'QDeviceInfo' was not declared in this scope
                              QDeviceInfo sysInfo=new QDeviceInfo(this);
                              ^
                              I tried with this source code:

                              QDeviceInfo sysInfo=new QDeviceInfo(this);
                              qDebug()<<"NetManager::NetManager imei:"<<sysInfo->imei(0);
                              

                              Thanks

                              1 Reply Last reply Reply Quote 0
                              • SGaist
                                SGaist Lifetime Qt Champion last edited by

                                First thing, it's not an example, it's a Qt module, you should rather place it in the same source path as e.g. qtbase.

                                Like I wrote before, it's not yet implemented for Android

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post