With xamarin essential (IsRemoteReachable) I cannot measure or know if a web page is available
Is there any alternative to know that?
@HectorOrmeo said:
I need to know if the connection is optimal to send information to the rest service and wait for an answer!
example: send pictures
In the absence of a precise definition of what constitutes optimal, and given the variability of connection quality when using a mobile device, my suggestion would be to simply implement a timeout when posting a byte array to the REST host. Even if some metrics were generated before posting the byte array, those metrics are just a snapshot, so even if the metrics looked good, the posting of the byte array just afterwards might be really slow (or not succeed at all). So, you might as well just post the byte array and timeout if it takes longer than you deem acceptable.
If you disagree, I can suggest some alternative options, but I'm not convinced that they would add value beyond what a timeout would do.
Answers
IsReachable is not implemented in Xamarin.Essentials as each device handles this very different and was never 100% reliable. That will actually slow your app down by pinging and then making the request. See the link.
To check if an end point is available, try to use Xam.Plugin.Connectivity plugin.
Tutorial: https://jamesmontemagno.github.io/ConnectivityPlugin/PingaHost.html
The cross connectivity method did not work
.
Is there a way to measure latency?
Just to clarify - do you want to:
(a) know if a remote address is reachable (if so, does reachable mean that you can make a TCP connection to it, or is ICMP enough?)
or
(b) measure latency? If latency, at what level in the network stack do you want to measure it? Will a round-trip time do? Given the variability when it comes to mobile devices, it would be useful to know what you are trying to achieve.
Hi, I need to measure latency, a round trip
At what level in the network stack?
What are you trying to achieve? (what's the use case / user requirement?)
I need to know if the connection is optimal to send information to the rest service and wait for an answer!> @JohnHardman
example: send pictures
In the absence of a precise definition of what constitutes optimal, and given the variability of connection quality when using a mobile device, my suggestion would be to simply implement a timeout when posting a byte array to the REST host. Even if some metrics were generated before posting the byte array, those metrics are just a snapshot, so even if the metrics looked good, the posting of the byte array just afterwards might be really slow (or not succeed at all). So, you might as well just post the byte array and timeout if it takes longer than you deem acceptable.
If you disagree, I can suggest some alternative options, but I'm not convinced that they would add value beyond what a timeout would do.
Hi @HectorOrmeo , check out this solution
The code returns the intensity of your wifi network
Post
https://luisdavidxamshap.wordpress.com/2019/05/09/intensidad-dewi-fi-xamarin-forms-version-android/
In the case of iOS, it needs more permissions, I don't have it
Check out the solution for Android
@LuisDavidDelaCruz
It's unclear (IMHO) what the original poster really needs (latency, round-trip time, whether a web page can be retrieved etc are not the same thing). I don't think that WiFi strength is what the original poster is asking for though.
WiFi strength could be potentially useful for other things though, so it's a pity that it seems the API is not permitted to be used in apps in the iOS app store.