0

I have made an app, in that I need to check if internet is available then it should work otherwise should give popup. As I have made whole app I want to avoid writing the internet connectivity check function in each activity or calling it multiple times. So I am wondering is there an easy way to check internet connectivity of app in whole app by writing it in either Manifest or other way?

Thanks in Advance

Mayank Bansal
  • 165
  • 3
  • 12

1 Answers1

0

In Android, there is a pretty neat resource called Broadcast Receiver. What you need to do is to declare a new class that extends a BroadCast Receiver object and then register in your manifest file for the "specific filter" that you are looking for, and whenever the connectivity goes away, or the network status change the Android SDK will launch an Intent in your app.

Check this question. : Broadcast receiver for checking internet connection in android app

Alifyz Pires
  • 73
  • 1
  • 7