vendredi 7 avril 2017

android random wireless network loss

I have an adroid app that for some reason would appear to drop wireless network connection and in turn stop things from working. The app works fine and for quite some time until this random issue happens. I use OKHTTP for making HTTP requests, a mix between get/post with no authentication on the web service being called. The requests are JSON based. I also use SignalR (java client from github) for sending out real time messages, again this works well for me. We use portsip sdk for voip calls.

So to my issue, my logs show things working fine until what appears to be this network loss. Both SignalR and OKHttp start to fail, as in the onFailure event for OKHTTP and a similar event for signalr. When it starts to fail i output to my logs what android thinks of the network connection ranging from ... is it turned on?, are we connected? and what SSID are we connected too and the odd thing is android still think it is connected too.

Other things to note are the phone is idle, screen is off but the app running as a foreground service and also have a background service too.

I send in status message into the server every minute via OKHTTP which i would have hoped it keeps the phone network alive but i must be wrong.

I am in the process of trying a wifi lock with WifiManager.WIFI_MODE_FULL_HIGH_PERF changed from using WifiManager.WIFI_MODE_FULL to see if this makes a difference.

I also have code to try and force reconnect to the wifi but this doesn't seem to have any effect either.

I will look to posting logs and code next but hints, tips or code changes would be appreciated.




Aucun commentaire:

Enregistrer un commentaire