example 'meshtastic': fix background mode on android; revisions

This commit is contained in:
pls.153 2024-03-02 18:07:24 +01:00
parent 44bd77cb08
commit 3585e7886a
7 changed files with 13 additions and 3 deletions

View file

@ -191,7 +191,7 @@ void BLE_ME::setBackgroundMode(bool background) {
}
static QString packetsFile() {
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/meshtastic-packets.bin";
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/../meshtastic-packets.bin";
}
void BLE_ME::saveBytes(const QByteArray& packet) {

View file

@ -108,6 +108,7 @@ QT::QT() : QObject() {
[&](Qt::ApplicationState state) {
if (state == Qt::ApplicationInactive) {
ble->setBackgroundMode(true);
ecl_fun("app:on-background-mode");
} else if (state == Qt::ApplicationActive) {
ble->setBackgroundMode(false);
}

View file

@ -173,6 +173,9 @@
(dolist (packet packets)
(received-from-radio packet))
(receiving-done)
;; this will show eventual red circles with numbers of unread messages
(q> |currentIndex| ui:*group-view* -1)
(q> |currentIndex| ui:*main-view* 0) ; 'Group'
(values))
(defun node-to-name (num)

View file

@ -51,6 +51,11 @@
(lora:get-node-config)))
(values))
(defun on-background-mode () ; see Qt
;; for showing number of unread messages
(change-setting :latest-receiver nil)
(values))
;;; settings
(let (file)

View file

@ -13,6 +13,7 @@
#:message-dialog
#:make-backup
#:my-ip
#:on-background-mode
#:on-config-complete
#:restore-eventual-backup
#:save-settings

View file

@ -4,7 +4,7 @@
(defun ini ()
(q> |model| ui:*region*
(cons "-" (rest (mapcar 'symbol-name (lora:keywords :region-code)))))
(mapcar 'symbol-name (lora:keywords :region-code)))
(x:when-it (app:setting :region)
(q> |currentIndex| ui:*region*
(q! |indexOfValue| ui:*region*

View file

@ -63,7 +63,7 @@
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<meta-data android:name="android.app.background_running" android:value="true"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>