Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QAndroidJniObject>
- #include <QAndroidService>
- #include <QCoreApplication>
- #include <QDebug>
- #include <QtAndroid>
- int main(int argc, char *argv[])
- {
- if (argc <= 1) {
- // code to handle main activity execution
- } else if (argc > 1 && strcmp(argv[1], "-service") == 0) {
- QAndroidService app(argc, argv);
- QAndroidJniObject::callStaticMethod<void>(
- "com/kdab/training/MyService", "startMyService",
- "(Landroid/content/Context;)V",
- QtAndroid::androidActivity().object());
- qDebug() << "QtAndroidService - Service starting with from the same "
- ".so file";
- qDebug() << "QtAndroidService - Hello World from Qt Android Service";
- return app.exec();
- } else {
- qWarning() << "QtAndroidService - Unrecognized command line argument";
- return -1;
- }
- }
Add Comment
Please, Sign In to add comment