Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Notification to PCL when WiFi state changed?

$
0
0

Good afternoon everyone-

I have a quick (hopefully) question regarding receiving a state change notification for WiFi connectivity. The simple version: How do I get notification in my PCL that WiFi state has changed?

The complex version:
I have an app that would consume a huge amount of data if i let it, due to the size of the databases and the number of images that are displayed/added/updated (it's an inventory management application, before anyone yells at me about data usage :) ).

The use case came down from the bosses that data intensive should only work on WiFi connection - no option for cellular data. I've built out the dependency services for GetWiFiConnectivity, and that works just fine. What I'm doing is when I try to send a request over cell data, I pend it to a database until WiFi is connected, and then sync the data at that point.

So my question is this. I can check via the dependency service whether WiFi is enabled explicitly, but (using Android for the sake of brevity here:) is there a way I can receive, in my PCL, the notification from a broadcast receiver that the WiFi state has changed? i.e. fire an event handler or OnPropertyChanged when the broadcast receiver receives the notification that WiFi changed?

Thanks in advance, and I'm sorry if that's confusing...I can clarify if needed.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>