Archive for January, 2011

Android: Check network connection

January 8, 2011 2 comments

This will help to to detect if your android has any internet connection

This will return true i.e your application has internet connection.

 private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null;

Enjoy.. 😉 !!!!!!!

Categories: Android Tags:

Android: Check if Airplane mode is on

January 8, 2011 Leave a comment

This will help u check if your android is in airplane/fight mode

static boolean isAirplaneEnabled;
isAirplaneEnabled = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1;

Enjoy.. 😉 !!!!!!!

Categories: Android Tags: ,
%d bloggers like this: