-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection Drops after 15 mins #1
Comments
This is the hardest problem with all of my android apps.
Obvliously I went for background, because bacgkround messages are sent to the application, and the application then handles the data. The problem here is the same as before: Not every background message reaches the device. A little browsing on the internet shows that many people have this problem, but no solution exists. FCM works stable with Notification mode, which is OK for Chat, Calendar applications and Games. Your application only knows of the notification when it's pressed by the user and it will open your application. ConslusionWe can try but I think nothing will work, I even saw more strict rules on background services with android 8.1 Oreo, where not even holding a wakelock can keep the device awake, because it is automatically released. Basically android's idea is we only need to handle data when the user is using the phone, otherwise save battery and only FCM notifications can work, which again, needs user action for the application to handler the data. And some help forums now ask what is the purpose of constant connection, instead of trying to fix the problem. If you try to wake the device say every 5 seconds that's inconsistent too. After a while the device just stops some hardware components and only turns them on when the users wake their phones. |
Some Apps on startup ask for Permission to be placed in Battery Optimization, which allows them to run in the background.
The app has to be added manually by the user. Also try to make the app "Device Admin" as well, there is a chance these apps will not stop working in the background if the device is locked or idle. https://developer.android.com/guide/topics/admin/device-admin.html |
some progress with this? |
yk how i can use it and download it? |
Hi,
While I was testing on Android 5.1.1 (Lollipop), if the mobile remains Idle for around 15 minutes, the Connection of the Client with the Server Drops and never Re-Connects. Even if the Server is Restarted, it does not connect. The Client is still running in the background. Even if I re-open the client, there is still no connection. The Only way to re-establish the connection is to End Task the client from background and then re-open the app, then the connection is established but again for no more than 15 mins of Idle time.
I have checked the code, it should be running as a "service" and "start_sticky" should make the 'NetworkHandler.class' to restart once it is destroyed or loses connection. May be it needs a "Keep-Alive" kind of a function to keep the connection active with the server for as long as possible and once the connection is dropped, start the process again.
The text was updated successfully, but these errors were encountered: