Guest User

Untitled

a guest
Jul 10th, 2020
19
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <QAndroidJniObject>
  2. #include <QAndroidService>
  3. #include <QCoreApplication>
  4. #include <QDebug>
  5. #include <QtAndroid>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.  
  10. if (argc <= 1) {
  11. // code to handle main activity execution
  12. } else if (argc > 1 && strcmp(argv[1], "-service") == 0) {
  13. QAndroidService app(argc, argv);
  14.  
  15. QAndroidJniObject::callStaticMethod<void>(
  16. "com/kdab/training/MyService", "startMyService",
  17. "(Landroid/content/Context;)V",
  18. QtAndroid::androidActivity().object());
  19.  
  20. qDebug() << "QtAndroidService - Service starting with from the same "
  21. ".so file";
  22. qDebug() << "QtAndroidService - Hello World from Qt Android Service";
  23. return app.exec();
  24. } else {
  25. qWarning() << "QtAndroidService - Unrecognized command line argument";
  26. return -1;
  27. }
  28. }
RAW Paste Data