Comments (3)
Probably its related to the issue I just posted, try to use a foreground service if you don't already. With the foreground service also if it disconnects then i am able to correctly detect disconnection and reconnect it in foreground.
from paho.mqtt.android.
did you succeed in reconnecting in a foreground service?
from paho.mqtt.android.
Yes, you need to run a foreground service, check in an handler if you are connected to the mqtt client (i use eventbus for communicating between activities and intercept changes), if not connected the connect again.
To let it work you need to deactivate battery optimization otherwise android won't let your app work in foreground.
To let the app work in foreground personally i do use a persistent notification that keeps the app awake until the user stops the task.
from paho.mqtt.android.
Related Issues (20)
- The foreground service types are required since Android 14 HOT 2
- Started service vs bound service HOT 10
- Calling disconnect twice results in crash HOT 1
- Exact alarm HOT 6
- Network change results in a NullPointerException. HOT 17
- Sending when not connected results in crash HOT 1
- connectionLostAction crash: MqttException cannot be cast to android.os.Parcelable HOT 2
- Interference with Filterable HOT 2
- toolbar overlapped with notfication bar HOT 3
- PROBLEM TO POPULATE TEXTVIEW WITH MESSAGE_ARRIVED HOT 2
- IllegalArgumentException for Android S+ Version HOT 4
- 在发送心跳时 cpu占用高 HOT 2
- BroadcastReceiver components are not allowed to bind to services HOT 4
- The play store console stated that am using FOREGROUND_SERVICE_DATA_SYNC even though I don't. HOT 8
- WorkManager version, WAKE_LOCK permission and Chucker Library HOT 5
- Long running tessts in sleep mode HOT 2
- Unexplained websocket disconnection precisely 5 minutes after the connection is established HOT 4
- Need Android 14 support - App Crashes HOT 2
- MQTT连接后androidx.work mqtt的消息也收不到 HOT 1
- android14设备,使用3.6.4,经常会断开连接,提示:已断开连接 (32109) - java.net.SocketException: Software caused connection abort
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paho.mqtt.android.