AbsoluteSith
AbsoluteSith

Reputation: 1967

How to trigger a method in foreground when internet is available in UWP?

I know we can create a background trigger when the internet is available. But is there a method to trigger a call when the internet becomes available in the foreground app?

Currently I'm polling every few minutes to check if the internet is available but this is not so efficient.

Thanks in advance.

Upvotes: 0

Views: 104

Answers (1)

A.J.Bauer
A.J.Bauer

Reputation: 3001

Try:

NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;

MSDN NetworkInformation

Upvotes: 2

Related Questions