a base KOTLIN class to check connection continuously:
after creating your koltin app and add this two classes you should change every activity class "AppCompatActivity()" to "BaseActivity()", by that it will show an alert dialog every time wifi is off and after turning wifi on and internet connect to the app the alert will dimiss.