Context: I'm developing an Android app with .NET Maui. My app transfers files to a server. Server can be in LAN only or accessible via internet. Before transfer, connection to server is tested. If connection fails, the transfer is deferred until there is connection. The connection should be attempted again when the device connects to a different network. It can be via wifi or mobile data.
Question: How can I listen to network changes when the app is in the background? I want transfer to be re-tried immediately when the network changes, even if there has been a phone restart in between.