Here is a method you can use to validate whether a data connection is available or not:
public static boolean isDataConnectionAvailable(Context context) {
ConnectivityManager connectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
}
If this returns true then you can do your logic to display a dialog box. There are plenty of examples available on StackOverflow for using dialog boxes so I will trust you can locate those and implement your functionality successfully.
solved If Data connection is on then show a dialog. otherwise not [closed]