Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QApplication inactive after start android app



  • Hi!

    I have only one activity which inherited from QtActivity.
    For my application, I download the library from the server. In QLoader, if there are no local libs, then I call my service and download the libraries. After I call QLoader.loadApplication with prepared parameters for loading.
    The application starts, the qml interface is displayed and works. The problem is that some functionality does not work, such as showing a android keyboard, camera, WebView. I found that my application has the state Qt::ApplicationInactive. After minimizing and expanding the application, everything works correctly.
    On android, the focus is set to my activity.

    adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
      mCurrentFocus=Window{7b3f79 u0 org.example.mobile/org.example.mobile.MyActivity}
      mFocusedApp=AppWindowToken{2e8f778 token=Token{7066692 ActivityRecord{da8241d u0 org.example.mobile/.MyActuvuty t1132}}}
    
    

    Also for testing, before starting the application (QLoader.loadApplication) I create a new activity that is just finished. And it solves the problem. State changes to Qt::ApplicationActive

    Intent intent = new Intent(MyActivity.this, FixActivity.class);
    startActivity(intent);
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            finish();
        }
    

    Does anyone know what the problem is?


Log in to reply