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
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,
_
Re: Controlling Android's hardware subsystems via Qt
Quote:
Originally Posted by
anda_skoa
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
Re: Controlling Android's hardware subsystems via Qt
Quote:
Originally Posted by
MarkoSan
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
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,
_
Re: Controlling Android's hardware subsystems via Qt
Quote:
Originally Posted by
anda_skoa
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:
Code:
TEMPLATE = app
QT += qml quick widgets sql core androidextras
SOURCES += main.cpp \
settings/uepossettings.cpp \
database/uepeoplemodel.cpp \
core/uestatus.cpp \
core/uestatusrecord.cpp
RESOURCES += qml.qrc \
ueicons.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)
HEADERS += \
settings/uedefaults.h \
settings/uepossettings.h \
database/uepeoplemodel.h \
core/uestatus.h \
core/uestatusrecord.h \
core/uedatabaseconnectionstatus.h \
core/uetypes.h
QMAKE_CXXFLAGS += -Wunused
,
I get qmake error:
Quote:
Project ERROR: Unknown module(s) in QT: androidextras
Why?
Re: Controlling Android's hardware subsystems via Qt
Quote:
Originally Posted by
MarkoSan
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
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,
_
1 Attachment(s)
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:
Attachment 11386