added tries for auto-reconnect and persistence

master
Tibor 1 year ago
parent 786edeb75d
commit f21aa58603
  1. 4
      DoorOpener.cpp
  2. 2
      android/AndroidManifest.xml

@ -25,6 +25,10 @@ void DoorOpener::initializeWithMqtt()
// TODO this is bad architecture. it should be safe to know when the connection is established. (see main.qml)
if (_client->state() != QMqttClient::Connected) {
_client->connectToHost();
_client->setAutoKeepAlive(true);
// auto-reconnect
QObject::connect(_client, &QMqttClient::disconnected, [&](){ _client->connectToHost(); });
}
if (QFile atFile { "access_token" }; atFile.open(QIODevice::ReadOnly)) {

@ -12,7 +12,7 @@
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Heimdall" android:extractNativeLibs="true" android:icon="@drawable/icon">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Heimdall" android:extractNativeLibs="true" android:icon="@drawable/icon" android:persistent="true">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>