How to check Internet connectivity in my Google map application (Android) -



How to check Internet connectivity in my Google map application (Android) -

how set network validation on google map,its working when net or wifi on.but not working when net down

please, seek this. hope help you.

public static int type_wifi = 1; public static int type_mobile = 2; public static int type_not_connected = 0; public static int getconnectivitystatus(context context) { connectivitymanager cm = (connectivitymanager) context .getsystemservice(context.connectivity_service); networkinfo activenetwork = cm.getactivenetworkinfo(); if (null != activenetwork) { if(activenetwork.gettype() == connectivitymanager.type_wifi) homecoming type_wifi; if(activenetwork.gettype() == connectivitymanager.type_mobile) homecoming type_mobile; } homecoming type_not_connected; } public static string getconnectivitystatusstring(context context) { int conn = networkutil.getconnectivitystatus(context); string status = null; if (conn == networkutil.type_wifi) { status = "wifi enabled"; } else if (conn == networkutil.type_mobile) { status = "mobile info enabled"; } else if (conn == networkutil.type_not_connected) { status = "not connected internet"; } homecoming status; }

android google-maps google-maps-api-2

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -