I created a vpn application based on wireguard. But some users sometimes lose vpn-connection without any reason. Can I programmatically detect when a vpn connection is dropped and reconnect? Is there some callback that will notify the application?
Related
Is there any way to create push notifications with Flutter without using Firebase (FCM)? Would it be possible to have a background job that has a socket connection to the message backend to receive the notification?
There is no way to do deliver messages to apps that are not actively being used without FCM/APNS, as that would require the process to keep a socket connection open even during this inactivity. The underlying operating systems (iOS and Android) either don't allow this to begin with, or actively kill such open connections after a short period of the app being inactive.
I have an issue on firebase; the listener is connected to realtime database with personal hotspot and gets updates from database correctly, but when the hotspoter changes the network quality from 3G to LTE (or another, doesn't matter), the listener starts to not get updates from realtime database anymore. How can I detect this issue?
The Firebase SDK uses various mechanism to detect whether the socket it uses to communicate with the server is still active, but unfortunately these are not always reliable on all (especially) mobile providers.
You could enable debug logging to see what the SDK is going during those 10 minutes, or you could detect the network switch yourself and call goOffline()/goOnline in quick succession so that the SDK creates a new connection.
I´m developing a XMMP android client with a smack, the problem is that the login delay too,
When I launch the first connection run well, but I have a broadcast receiver to listen network changes, and when I stop the connection and relaunch it due to a changes of networks, the server delay too and sometime can´t login in to the server!
Maybe you should use a session attachment! This is by far the most robust way of establishing an xmpp connection the next time you reconnect it again.
I have written a client server app that connect two iphones using bonjour. My problems is that when both devices start broadcasting and listening using bonjour they find each other at the same moment and both of them connect as a client of each other. How can I avoid this scenario? I am already checking if my app is connected as a server to the other app, but since that happens simultaneously I always connect as a server and client at the same time.
looking into ur case ; 1 solution is that u can make ur device on which app is hosted and gotta serve as server make that devices tcb as passive open so it can only listen on particular port/frequency and client can be programed to be in active open state so it can send request to server.
I want to check the user whether using whether wifi/3G connect or not, how can I check this behavior? thank you.
Use Apple's "Reachability" sample app. It's become the code most used for determining network connectivity.
http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html
You can check once at launch time for network access, or set yourself up as a notification consumer of network connection change messages.
This is important these days because Apple will test your app in Airplane Mode, and if it requires network connections it can't get, but doesn't handle that nicely, they'll bounce your submission.