I am working on a live project. and when user click on the app. the welcome screen appears(there is a webview on that screen). and if the internet is not connected then the
Internet connection also check either in onCreate() or onResume() method. There is no need to call inside the AsyncTask.
onCreate()
onResume()
or You can call before call the AsyncTask execute() method
if(isOnline) { MyAsyncTask task=new MyAMyAsyncTask(); task.execute(); } else { // no internet connection }