mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
example 'meshtastic': make android service a foreground service; revisions
This commit is contained in:
parent
c2890cd6c4
commit
576af18aa7
6 changed files with 58 additions and 24 deletions
|
|
@ -31,22 +31,9 @@ QObject* ini() {
|
|||
return qt;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
static void startService() {
|
||||
QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(),
|
||||
"org/cl/meshtastic/QtAndroidService");
|
||||
QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod(
|
||||
"startService",
|
||||
"(Landroid/content/Intent;)Landroid/content/ComponentName;",
|
||||
serviceIntent.handle().object());
|
||||
}
|
||||
#endif
|
||||
|
||||
QT::QT() : QObject() {
|
||||
#ifdef Q_OS_ANDROID
|
||||
// android service using remote object
|
||||
startService();
|
||||
|
||||
// remote object for android service
|
||||
QRemoteObjectNode* repNode = new QRemoteObjectNode;
|
||||
repNode->connectToNode(QUrl(QStringLiteral("local:replica")));
|
||||
QSharedPointer<QtAndroidServiceReplica> rep(repNode->acquire<QtAndroidServiceReplica>());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue