47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include <QtCore>
|
|
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQuickView>
|
|
#include <QQmlContext>
|
|
#include "automator.h"
|
|
#include "AndroidNative/systemdispatcher.h"
|
|
|
|
#ifdef Q_OS_ANDROID
|
|
#include <QtAndroidExtras/QAndroidJniObject>
|
|
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
|
|
|
using namespace AndroidNative;
|
|
|
|
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
|
Q_UNUSED(vm);
|
|
qDebug("NativeInterface::JNI_OnLoad()");
|
|
|
|
// It must call this function within JNI_OnLoad to enable System Dispatcher
|
|
SystemDispatcher::registerNatives();
|
|
|
|
/* Optional: Register your own service */
|
|
|
|
// Call quickandroid.example.ExampleService.start()
|
|
QAndroidJniObject::callStaticMethod<void>("quickandroid/example/ExampleService",
|
|
"start",
|
|
"()V");
|
|
|
|
return JNI_VERSION_1_6;
|
|
}
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
engine.addImportPath("qrc:///");
|
|
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
|
|
|
/* Testing Code. Not needed for regular project */
|
|
Automator* automator = new Automator();
|
|
automator->start();
|
|
|
|
return app.exec();
|
|
}
|