Skip to content

All about Qt on Android BogDan Vatra

In this session we’ll see real life examples of using JNI on Android. We’ll start by checking the Qt 5.7 goodies which will make our lives easier, then we’ll see simple examples that you’ll need to use in almost any Qt on Android application, and we’ll end up with an Android Service made with Qt.

In this session we’ll see real life examples of using JNI on Android. We’ll start by checking the Qt 5.7 goodies which will make our lives easier, then we’ll see simple examples that you’ll need to use in almost any Qt on Android application. At the end, we’ll see how to create an Android Service made with Qt, and we’ll see how to use QtRemoteObjects to communicate with that service.

View the slides

FacebookTwitterLinkedInEmail

Categories: Presentation videos / Qt

1 thought on “All about Qt on Android”

  1. , All about Qt on Android

    Informative thanks for your presentations I have used them to get going. However I tried the example to keep screen on. I added a comma. but it still have error compiling.

    void keepScreenOn(bool on) {
    static const int FLAG_KEEP_SCREEN_ON
    = QAndroidJniObject::getStaticField( “android/view/WindowManager$LayoutParams”, “FLAG_KEEP_SCREEN_ON” );

    QtAndroid::runOnAndroidThread([on, FLAG_KEEP_SCREEN_ON] {
    auto window = QtAndroid::androidActivity().callObjectMethod(“getWindow”,
    “()Landroid/view/Window;”);
    if (on)
    window.callMethod(“addFlags”, “(I)V”, FLAG_KEEP_SCREEN_ON);
    else
    window.callMethod(“clearFlags”, “(I)V”, FLAG_KEEP_SCREEN_ON);
    }); //ADDED Comma
    }

    error:
    ../src/example/MainWindow.cpp:76:38: error: ‘FLAG_KEEP_SCREEN_ON’ cannot be captured because it does not have automatic storage duration
    QtAndroid::runOnAndroidThread([on, FLAG_KEEP_SCREEN_ON] {
    ^
    ../src/example/MainWindow.cpp:73:20: note: ‘FLAG_KEEP_SCREEN_ON’ declared here
    static const int FLAG_KEEP_SCREEN_ON

Leave a Reply

Your email address will not be published. Required fields are marked *