While developing an app in android which needs network connectivity, it is required to check if the server is available (visible) .. For that, just follow these simple steps which is given below and you are done :- Step 1: Create a class AppStatus in your project(you can give any other name also). Then please paste the given below lines into your code Java import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; public class AppStatus { private static AppStatus instance = new AppStatus(); ConnectivityManager connectivityManager; NetworkInfo wifiInfo, mobileInfo; private boolean registered = false; private boolean update = false; private String auth_key; private String device_key; static Context context; boolean connected = false; public static AppStatus getInstance(Context ctx) { context = ctx; return instance; } public Boolean... Read More »
Categories
Archives
- July 2012 (4)
- June 2012 (4)
- March 2012 (4)
- February 2012 (2)
- January 2012 (1)
- December 2011 (1)
- October 2011 (1)
- September 2011 (1)
- July 2011 (1)
- May 2011 (1)
- April 2011 (1)
- March 2011 (2)
- February 2011 (2)
- December 2010 (1)
- August 2010 (1)
- June 2010 (1)
- May 2010 (2)
- June 2009 (1)