Results 1 to 7 of 7

Thread: Controlling Android's hardware subsystems via Qt

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question Controlling Android's hardware subsystems via Qt

    Hello!

    I am working on some app (using Qt Creator running on Kubuntu 15.04), which will eventually be deployed to tablet using Android OS. Now, how do you, for example, turn on/off mobile internet or turn on/off wifi with Qt/QML code? Does anyone has some code examples? Is Android NDK needed to be included in Qt Creator project for such tasks to be achieved?

    Sincerely,
    Marko
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Controlling Android's hardware subsystems via Qt

    You will need the NDK to build your application for Android.

    Some functionality is provided in Qt itself, some in QtAndroidExtra module.
    For other features you'll have to call into the Java stub of the application and use the Java API from there.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    MarkoSan (21st September 2015)

  4. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Controlling Android's hardware subsystems via Qt

    Quote Originally Posted by anda_skoa View Post
    You will need the NDK to build your application for Android.

    Some functionality is provided in Qt itself, some in QtAndroidExtra module.
    For other features you'll have to call into the Java stub of the application and use the Java API from there.

    Cheers,
    _
    Is androidextras only available in licensed versions of Qt? And, do you have some examples calling java stub?
    Sincerely,
    Marko
    Qt 5.3 Opensource & Creator 3.1.2

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Controlling Android's hardware subsystems via Qt

    Quote Originally Posted by MarkoSan View Post
    Is androidextras only available in licensed versions of Qt?
    All versions of Qt are licensed.

    http://doc.qt.io/qt-5/qtandroidextras-index.html

    Quote Originally Posted by MarkoSan View Post
    And, do you have some examples calling java stub?
    Sorry, no. Seen that in a presentation once but never done any Qt on Android work myself.

    The code of the Qt Android Extras module is likely to contain some input on that though

    Cheers,
    _

  6. #5
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Controlling Android's hardware subsystems via Qt

    Quote Originally Posted by anda_skoa View Post
    All versions of Qt are licensed.

    http://doc.qt.io/qt-5/qtandroidextras-index.html


    Sorry, no. Seen that in a presentation once but never done any Qt on Android work myself.

    The code of the Qt Android Extras module is likely to contain some input on that though

    Cheers,
    _
    What I meant is if Qt Android Extras is availabe under open source Qt?
    And, if I add androidextras into .pro file:
    Qt Code:
    1. TEMPLATE = app
    2.  
    3. QT += qml quick widgets sql core androidextras
    4.  
    5. SOURCES += main.cpp \
    6. settings/uepossettings.cpp \
    7. database/uepeoplemodel.cpp \
    8. core/uestatus.cpp \
    9. core/uestatusrecord.cpp
    10.  
    11. RESOURCES += qml.qrc \
    12. ueicons.qrc
    13.  
    14. # Additional import path used to resolve QML modules in Qt Creator's code model
    15. QML_IMPORT_PATH =
    16.  
    17. # Default rules for deployment.
    18. include(deployment.pri)
    19.  
    20. HEADERS += \
    21. settings/uedefaults.h \
    22. settings/uepossettings.h \
    23. database/uepeoplemodel.h \
    24. core/uestatus.h \
    25. core/uestatusrecord.h \
    26. core/uedatabaseconnectionstatus.h \
    27. core/uetypes.h
    28.  
    29. QMAKE_CXXFLAGS += -Wunused
    To copy to clipboard, switch view to plain text mode 
    ,
    I get qmake error:
    Project ERROR: Unknown module(s) in QT: androidextras
    Why?
    Qt 5.3 Opensource & Creator 3.1.2

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Controlling Android's hardware subsystems via Qt

    Quote Originally Posted by MarkoSan View Post
    What I meant is if Qt Android Extras is availabe under open source Qt?
    Unless it specifically says that it is only available as an extension in the so called commerical package, then yes.
    The open source Qt is the default one.

    But that can easily be verified by looking at the code, e.g.:
    http://code.woboq.org/qt5/qtandroide...nctions.h.html

    Quote Originally Posted by MarkoSan View Post
    I get qmake error:
    Project ERROR: Unknown module(s) in QT: androidextras
    Why?
    Maybe you don't have the module installed.
    Did you build yourself or did you use the download for Android development?

    Cheers,
    _

  8. #7
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question Re: Controlling Android's hardware subsystems via Qt

    Here are installed components, android portion is installed - I used Qt's MaintenanceTool for installation of Qt, did not build it myself:
    Qt55InstalledComponents.jpg
    Qt 5.3 Opensource & Creator 3.1.2

Similar Threads

  1. Replies: 4
    Last Post: 10th July 2014, 15:22
  2. How do you make android applications display correctly on android phone?
    By Cyrebo in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 17th August 2013, 07:31
  3. GDB: Failed to set controlling terminal
    By dbrich in forum Installation and Deployment
    Replies: 1
    Last Post: 1st October 2010, 14:18
  4. Controlling QCompleter's pop-up
    By dthh in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2010, 01:19
  5. QMessageBox: Controlling the width
    By ChrisW67 in forum Newbie
    Replies: 8
    Last Post: 14th August 2009, 22:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.