Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84382

QtAndroidExtras in Qt 6



    • AndroidExtras in Qt6
    • Android


      QtAndroidExtras contains many important APIs to interact with the Android API with the JNI calls. To ensure the proper working of Qt apps on Android, things like permission handling and dealing with intent are very important, as well as permission handling which is needed by many examples/applications. In general, Qt doesn't need to implement everything that is OS-specific, but at least the tools to do that should be from the start. Other platforms, like iOS, allow using platform API with Qt, for Android that's only available through the JNI, thus it's important to have that ready by default whenever needed by the users. Since we're seeing more attention towards Qt for Android, this is not something that we should leave out.

      We're not having Android Extras in Qt 6.0 however, in the subsequent releases (6.1, 6.2) we aim to include the fundamental most needed features from QtAndroidExtras into QtBase. 

      From the discussion and comments below, Qt Android Extras' the following parts can be moved/re-designed in upcoming releases of Qt namely Qt 6.1/6.2 outside of QtAndroidExtras:

      • QAndroidJniObject is mandatory and most important, it has many convenient functions to interact with JNI calls.
      • QAndroidJniEnvironment This could include a new function registerNatives() to facilitate registering native methods. Uses for this is to register natives, create class instances, use the JNIEnv* to process JNI objects like arrays.
      • QAndroidService is a QGuiApplication alternative to run a service loop, while AndroidExtras have more service classes, this is mandatory for all services even when working with remote objects. Other classes to handle services, intents could be kept in extras.

      The list below is for items that are still to be decided soon:

      • QtAndroid namespace, mainly for handling permissions and activities/intents.
        • activity() , androidContext(), sdkVersion() (could have "android" prefix)
        • All permission handling functions.
      • QAndroidIntent class for calling and receiving intents (exchange data).


      Also, since many other modules are now relying on either qtandroidextras or qtbase private jni headers, they should be all updated as soon as we have the intended JNI changes in place. The modules affected: qtsensors, qtmultimedia, qtconnectivity, qtlocation, qtgamepad, qtwebview, qtpurchasing.



        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              assam Assam Boudjelthia
              assam Assam Boudjelthia
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Rami Potinkara Rami Potinkara
              13 Vote for this issue
              31 Start watching this issue