Esempio n. 1
0
 public static void getLocation() {
   Log.d(TAG, "getLocation");
   if (m_instance.m_lm == null)
     m_instance.m_lm = (LocationManager) m_instance.getSystemService(Context.LOCATION_SERVICE);
   if (m_instance.m_lm.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
     m_instance.m_handler.sendMessage(m_handler.obtainMessage(2));
   } else {
     // open gps
     Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
     m_instance.startActivityForResult(intent, GET_LOCATION_REQUEST_CODE);
   }
 }
Esempio n. 2
0
 public static int networkState() {
   ConnectivityManager mgr =
       (ConnectivityManager) m_instance.getSystemService(Context.CONNECTIVITY_SERVICE);
   NetworkInfo networkInfo = mgr.getActiveNetworkInfo();
   return (networkInfo != null && networkInfo.isAvailable()) ? 1 : 0;
 }