List of usage examples for android.content Context LOCATION_SERVICE
String LOCATION_SERVICE
To view the source code for android.content Context LOCATION_SERVICE.
Click Source Link
From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java
@Override protected void onResume() { super.onResume(); try {//from w w w .ja v a 2 s . c o m this.mWakeLock.acquire(); // ?? ? killOnError(); // ? ? mixContext.mixView = this; // ?? dataView.doStart(); // ?? dataView.clearEvents(); // ? ? double angleX, angleY; // ? x, y /*? ? ? */ angleX = Math.toRadians(-90); m1.set(1f, 0f, 0f, 0f, (float) Math.cos(angleX), (float) -Math.sin(angleX), 0f, (float) Math.sin(angleX), (float) Math.cos(angleX)); angleX = Math.toRadians(-90); angleY = Math.toRadians(-90); m2.set(1f, 0f, 0f, 0f, (float) Math.cos(angleX), (float) -Math.sin(angleX), 0f, (float) Math.sin(angleX), (float) Math.cos(angleX)); m3.set((float) Math.cos(angleY), 0f, (float) Math.sin(angleY), 0f, 1f, 0f, (float) -Math.sin(angleY), 0f, (float) Math.cos(angleY)); m4.toIdentity(); for (int i = 0; i < histR.length; i++) { histR[i] = new Matrix(); } /* */ // ? sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); // ? ? // ?? sensors = sensorMgr.getSensorList(Sensor.TYPE_ACCELEROMETER); if (sensors.size() > 0) { sensorGrav = sensors.get(0); } // ? sensors = sensorMgr.getSensorList(Sensor.TYPE_MAGNETIC_FIELD); if (sensors.size() > 0) { sensorMag = sensors.get(0); } //// TODO: 2016-06-01 if (sensors.size() > 0) { sensors = sensorMgr_ori.getSensorList(Sensor.TYPE_ORIENTATION); orientationSensor = sensors.get(0); } // ?? ? ? ? ? sensorMgr.registerListener(this, sensorGrav, SENSOR_DELAY_GAME); sensorMgr.registerListener(this, sensorMag, SENSOR_DELAY_GAME); if (orientationSensor != null) { sensorMgr_ori.registerListener(this, orientationSensor, sensorMgr_ori.SENSOR_DELAY_GAME); } try { // ?? (Criteria) // http://developer.android.com/reference/android/location/Criteria.html Criteria c = new Criteria(); // ? c.setAccuracy(Criteria.ACCURACY_FINE); //c.setBearingRequired(true); // ? locationMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // ?? ? ? ? . 2 , 3 locationMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 4, this); // ?? ? , String bestP = locationMgr.getBestProvider(c, true); isGpsEnabled = locationMgr.isProviderEnabled(bestP); // gps, ? ? ? Location hardFix = new Location("reverseGeocoded"); try { // ? gps, ?? Location gps = locationMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER); Location network = locationMgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); // ? ? // gps > ? > if (gps != null) mixContext.curLoc = gps; else if (network != null) mixContext.curLoc = network; else mixContext.curLoc = hardFix; } catch (Exception ex2) { // ? ex2.printStackTrace(); // mixContext.curLoc = hardFix; // } // ? ? ?? mixContext.setLocationAtLastDownload(mixContext.curLoc); // ?? . ? GeomagneticField gmf = new GeomagneticField((float) mixContext.curLoc.getLatitude(), (float) mixContext.curLoc.getLongitude(), (float) mixContext.curLoc.getAltitude(), System.currentTimeMillis()); // ?? angleY = Math.toRadians(-gmf.getDeclination()); m4.set((float) Math.cos(angleY), 0f, (float) Math.sin(angleY), 0f, 1f, 0f, (float) -Math.sin(angleY), 0f, (float) Math.cos(angleY)); mixContext.declination = gmf.getDeclination(); } catch (Exception ex) { Log.d("mixare", "GPS Initialize Error", ex); // ? } // ? downloadThread = new Thread(mixContext.downloadManager); downloadThread.start(); } catch (Exception ex) { doError(ex); // ? try { // ??? if (sensorMgr != null) { sensorMgr.unregisterListener(this, sensorGrav); sensorMgr.unregisterListener(this, sensorMag); sensorMgr = null; } // ?? if (locationMgr != null) { locationMgr.removeUpdates(this); locationMgr = null; } // ?? ?? if (mixContext != null) { if (mixContext.downloadManager != null) mixContext.downloadManager.stop(); } } catch (Exception ignore) { } } // ?? // ?? ? ( ?? ) ? if (dataView.isFrozen() && searchNotificationTxt == null) { searchNotificationTxt = new TextView(this); searchNotificationTxt.setWidth(dWindow.getWidth()); searchNotificationTxt.setPadding(10, 2, 0, 0); searchNotificationTxt.setBackgroundColor(Color.DKGRAY); searchNotificationTxt.setTextColor(Color.WHITE); searchNotificationTxt.setOnTouchListener(this); addContentView(searchNotificationTxt, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } else if (!dataView.isFrozen() && searchNotificationTxt != null) { searchNotificationTxt.setVisibility(View.GONE); searchNotificationTxt = null; } }
From source file:com.ohnemax.android.glass.doseview.CSDataSort.java
private void initializeLocationManager() { locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); List<String> providers = locationManager.getAllProviders(); for (String provider : providers) { if (locationManager.isProviderEnabled(provider)) { Log.d(TAG, "Location provider added: provider = " + provider); } else {// w w w.ja v a 2 s . com Log.i(TAG, "Location provider not enabled: " + provider); } // TBD: Do this only for the currently enabled providers???? try { locationManager.requestLocationUpdates(provider, 5000L, 5.0f, new LocationListener() { @Override public void onLocationChanged(Location location) { Log.d(TAG, "locationChanged: location = " + location); processLocationData(location); } @Override public void onProviderDisabled(String provider) { Log.i(TAG, "providerDisabled: provider = " + provider); // TBD } @Override public void onProviderEnabled(String provider) { Log.i(TAG, "providerEnabled: provider = " + provider); // TBD } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Log.i(TAG, "statusChanged: provider = " + provider + "; status = " + status + "; extras = " + extras); // TBD } }); } catch (Exception e) { // ignore Log.w(TAG, "requestLocationUpdates() failed for provider = " + provider); } } }
From source file:com.ht.app.RestaurantsActivity.java
private Location getLastKnownLocation() { LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); String provider = lm.getBestProvider(criteria, true); if (provider == null) { return null; }//from ww w .ja va 2s . co m return lm.getLastKnownLocation(provider); }
From source file:com.seatgeek.placesautocompletedemo.MainFragment.java
private LatLng getLastKnownLocation(boolean isMoveMarker) { LocationManager lm = (LocationManager) TheApp.getAppContext().getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_LOW); String provider = lm.getBestProvider(criteria, true); if (provider == null) { return null; }/*from ww w .java2 s .c om*/ Activity activity = getActivity(); if (activity == null) { return null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (activity.checkSelfPermission( Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && activity.checkSelfPermission( Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return null; } } Location loc = lm.getLastKnownLocation(provider); if (loc != null) { LatLng latLng = new LatLng(loc.getLatitude(), loc.getLongitude()); if (isMoveMarker) { moveMarker(latLng); } return latLng; } return null; }
From source file:com.kmshack.BusanBus.activity.SearchMainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_common); setTitle(""); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerListener(new DrawerListener() { public void onDrawerOpened(View drawerView) { mDrawerToggle.onDrawerOpened(drawerView); getActionBarHelper().onDrawerOpened(); }// w ww . java 2 s . c o m public void onDrawerClosed(View drawerView) { mDrawerToggle.onDrawerClosed(drawerView); getActionBarHelper().onDrawerClosed(); } public void onDrawerSlide(View drawerView, float slideOffset) { mDrawerToggle.onDrawerSlide(drawerView, slideOffset); } public void onDrawerStateChanged(int newState) { mDrawerToggle.onDrawerStateChanged(newState); } }); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerToggle = new SherlockActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer_dark, R.string.drawer_open, R.string.drawer_close); mDrawerToggle.syncState(); mBusDb = BusDb.getInstance(getApplicationContext()); mUserDb = UserDb.getInstance(getApplicationContext()); mBusanBusPrefrence = BusanBusPrefrence.getInstance(getApplicationContext()); mInputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case TAB_NOSUN: searchNosun((String) msg.obj); break; case TAB_BUSSTOP: searchBusStop((String) msg.obj); break; } } }; mImageFavorite = (ImageView) findViewById(R.id.main_tap_favorite_image); mImageNosun = (ImageView) findViewById(R.id.main_tap_nosun_image); mImageBusstop = (ImageView) findViewById(R.id.main_tap_busstop_image); mImageLocation = (ImageView) findViewById(R.id.main_tap_setting_image); mFavoriteImageNosun = (TextView) findViewById(R.id.favorite_tab_nosun); mFavoriteImageBusstop = (TextView) findViewById(R.id.favorite_tab_busstop); mTextFavorite = (TextView) findViewById(R.id.main_tap_favorite_text); mTextNosun = (TextView) findViewById(R.id.main_tap_nosun_text); mTextBusstop = (TextView) findViewById(R.id.main_tap_busstop_text); mTextSetting = (TextView) findViewById(R.id.main_tap_setting_text); mNosunListView = (ListView) findViewById(R.id.lv_nosun); mBusStopListView = (ListView) findViewById(R.id.lv_busstop); mFavoriteListView = (DragSortListView) findViewById(R.id.lv_favorite); mNosunListView.setEmptyView((TextView) findViewById(R.id.nosun_empty)); mBusStopListView.setEmptyView((TextView) findViewById(R.id.busstop_empty)); mFavoriteListView.setEmptyView((TextView) findViewById(R.id.favorite_empty)); mFavoriteListView.setDropListener(mOnDrop); mFavoriteListView.setRemoveListener(mOnRemove); mTextSettingNotice = (TextView) findViewById(R.id.setting_notice); mTextSettingUpdate = (TextView) findViewById(R.id.setting_update); mLayoutSettingTextSize = (LinearLayout) findViewById(R.id.setting_textsize_sun); mLayoutSettingArrive = (LinearLayout) findViewById(R.id.setting_arrive_sun); mLayoutSettingFavorite = (LinearLayout) findViewById(R.id.setting_favorite_start); mLayoutSettingFavoriteLocation = (LinearLayout) findViewById(R.id.setting_favorite_location); mTextViewSettingTextSize = (TextView) findViewById(R.id.setting_textsize_value); mCheckSettingArrive = (ImageView) findViewById(R.id.setting_check_arrive_sun); mCheckSettingFavorite = (ImageView) findViewById(R.id.setting_check_favorite_start); mCheckSettingFavoriteLocation = (ImageView) findViewById(R.id.setting_check_favorite_location); mTextSettingNotice.setOnClickListener(mSettingClick); mTextSettingUpdate.setOnClickListener(mSettingClick); mLayoutSettingTextSize.setOnClickListener(mSettingClick); mLayoutSettingArrive.setOnClickListener(mSettingClick); mLayoutSettingFavorite.setOnClickListener(mSettingClick); mLayoutSettingFavoriteLocation.setOnClickListener(mSettingClick); findViewById(R.id.setting_opensource).setOnClickListener(mSettingClick); findViewById(R.id.setting_bin).setOnClickListener(mSettingClick); if (mBusanBusPrefrence.getIsArriveSort()) mCheckSettingArrive.setImageResource(R.drawable.btn_setting_checkbox_check); else mCheckSettingArrive.setImageResource(R.drawable.btn_setting_checkbox_uncheck); if (mBusanBusPrefrence.getIsFavoriteStart()) mCheckSettingFavorite.setImageResource(R.drawable.btn_setting_checkbox_check); else mCheckSettingFavorite.setImageResource(R.drawable.btn_setting_checkbox_uncheck); if (mBusanBusPrefrence.getIsFavoriteLocation()) mCheckSettingFavoriteLocation.setImageResource(R.drawable.btn_setting_checkbox_check); else mCheckSettingFavoriteLocation.setImageResource(R.drawable.btn_setting_checkbox_uncheck); mNosunSearchView = (LinearLayout) LayoutInflater.from(getApplicationContext()) .inflate(R.layout.search_bar_nosun, null); mNosunSearchView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mNosunEditText = (EditText) mNosunSearchView.findViewById(R.id.et_search_nosun); mNosunEditText.setHint(" "); mNosunEditText.setInputType(InputType.TYPE_CLASS_NUMBER); mNosunEditText.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { mHandler.removeMessages(TAB_NOSUN); Message msg = Message.obtain(mHandler, TAB_NOSUN, s.toString()); mHandler.sendMessageDelayed(msg, 200); } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); ((LinearLayout) findViewById(R.id.search_nosun)).addView(mNosunSearchView); mNosunListView.setOnScrollListener(new OnScrollListener() { public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) { } public void onScrollStateChanged(AbsListView arg0, int arg1) { mInputMethodManager.hideSoftInputFromWindow(mNosunEditText.getWindowToken(), 0); } }); mNosunListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { Cursor cursor = mMainNosunSearchAdapter.getCursor(); cursor.moveToPosition(position); String nosun = cursor.getString(1); String realtime = cursor.getString(cursor.getColumnIndexOrThrow("WEBREALTIME")); String up = cursor.getString(2); String down = cursor.getString(3); Intent intent = new Intent(getApplicationContext(), NosunDetailActivity.class); intent.putExtra("NoSun", nosun); intent.putExtra("RealTimeNoSun", realtime); intent.putExtra("Up", up); intent.putExtra("Down", down); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); mBusstopSearchView = (LinearLayout) LayoutInflater.from(getApplicationContext()) .inflate(R.layout.search_bar_busstop, null); mBusStopEditText = (EditText) mBusstopSearchView.findViewById(R.id.et_search_busstop); mBusStopEditText.setHint("/ "); mBusStopEditText.setInputType(InputType.TYPE_CLASS_TEXT); mBusStopEditText.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { mHandler.removeMessages(TAB_BUSSTOP); Message msg = Message.obtain(mHandler, TAB_BUSSTOP, s.toString()); mHandler.sendMessageDelayed(msg, 200); } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); ((LinearLayout) findViewById(R.id.search_busstop)).addView(mBusstopSearchView); mBusStopListView.setOnScrollListener(new OnScrollListener() { public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) { } public void onScrollStateChanged(AbsListView arg0, int arg1) { mInputMethodManager.hideSoftInputFromWindow(mBusStopEditText.getWindowToken(), 0); } }); mBusStopListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { Cursor cursor = mMainStopSearchAdapter.getCursor(); cursor.moveToPosition(position); String busStop = cursor.getString(2).toString(); Intent intent = new Intent(getApplicationContext(), BusstopDetailActivity.class); intent.putExtra("BusStop", busStop); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); mFavoriteListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { Cursor cursor = null; switch (mFavoriteMode) { case FAVORITE_TAB_NOSUN: cursor = mMainNosunFavoriteAdapter.getCursor(); break; default: cursor = mMainStopFavoriteAdapter.getCursor(); break; } if (cursor.getCount() > 0) { cursor.moveToPosition(position); Intent intent = null; switch (mFavoriteMode) { case FAVORITE_TAB_NOSUN: intent = new Intent(getApplicationContext(), BusArriveActivity.class); intent.putExtra("NOSUN", cursor.getString(1)); intent.putExtra("UNIQUEID", cursor.getString(2)); intent.putExtra("BUSSTOPNAME", cursor.getString(3)); intent.putExtra("UPDOWN", cursor.getString(4)); intent.putExtra("ORD", cursor.getString(6)); break; case FAVORITE_TAB_BUSSTOP: intent = new Intent(getApplicationContext(), BusstopDetailActivity.class); intent.putExtra("BusStop", cursor.getString(2)); break; } if (intent != null) { intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } } } }); mTabFavorite = (LinearLayout) findViewById(R.id.main_tap_favorite); mTabNosun = (LinearLayout) findViewById(R.id.main_tap_nosun); mTabBusstop = (LinearLayout) findViewById(R.id.main_tap_busstop); mTabLocation = (LinearLayout) findViewById(R.id.main_tap_location); mLayoutFavorite = (LinearLayout) findViewById(R.id.layout_main_favorite); mLayoutNosun = (LinearLayout) findViewById(R.id.layout_main_nosun_search); mLayoutBusstop = (LinearLayout) findViewById(R.id.layout_main_busstop_search); mLayoutLocation = (LinearLayout) findViewById(R.id.layout_main_location); mTabFavorite.setOnClickListener(mTabClickListener); mTabNosun.setOnClickListener(mTabClickListener); mTabBusstop.setOnClickListener(mTabClickListener); mTabLocation.setOnClickListener(mTabClickListener); mFavoriteImageNosun.setOnClickListener(mTabClickListener); mFavoriteImageBusstop.setOnClickListener(mTabClickListener); searchNosun(""); searchBusStop(""); if (mBusanBusPrefrence.getIsFavoriteStart()) { setTabChange(TAB_FAVORITE); } else { setTabChange(DEFAULT_TAB); } tracker.trackPageView("/SearchMain"); loadSettingTextSizeSelect(); }
From source file:android.melbournehistorymap.MapsActivity.java
@Override public void onRestart() { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); String locationProvider = LocationManager.GPS_PROVIDER; Location mLastLocation = locationManager.getLastKnownLocation(locationProvider); double lat = mLastLocation.getLatitude(); double lng = mLastLocation.getLongitude(); final int radius; int zoom;/*from w w w . j av a 2 s.c o m*/ //build current location LatLng currentLocation = new LatLng(lat, lng); if (MELBOURNE.contains(currentLocation)) { mMap.getUiSettings().setMyLocationButtonEnabled(true); zoom = 17; } else { mMap.getUiSettings().setMyLocationButtonEnabled(false); lat = -37.81161508043379; lng = 144.9647320434451; zoom = 15; currentLocation = new LatLng(lat, lng); } CameraPosition cameraPosition = new CameraPosition.Builder().target(currentLocation) // Sets the center of the map to location user .zoom(zoom) // Sets the zoom .bearing(0) // Sets the orientation of the camera to east .tilt(25) // Sets the tilt of the camera to 30 degrees .build(); // Creates a CameraPosition from the builder //Animate user to map location, if in Melbourne or outside of Melbourne bounds mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), new GoogleMap.CancelableCallback() { @Override public void onFinish() { updateMap(); } @Override public void onCancel() { } }); updateMap(); super.onRestart(); }
From source file:com.waz.zclient.pages.main.conversation.LocationFragment.java
@Override public void onConnectionFailed(ConnectionResult connectionResult) { // fallback to LocationManager Timber.e("Google API Client connection failed"); googleApiClient.unregisterConnectionFailedListener(this); googleApiClient.unregisterConnectionCallbacks(this); googleApiClient = null;/* ww w.ja v a 2 s .c o m*/ locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); if (PermissionUtils.hasSelfPermissions(getActivity(), LOCATION_PERMISSIONS)) { startLocationManagerListeningForCurrentLocation(); } else { ActivityCompat.requestPermissions(getActivity(), LOCATION_PERMISSIONS, LOCATION_PERMISSION_REQUEST_ID); } }
From source file:com.google.ytd.SubmitActivity.java
private void getVideoLocation() { this.locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_HIGH); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false);/*w ww . j a v a2 s .c o m*/ criteria.setSpeedRequired(false); criteria.setCostAllowed(true); String provider = locationManager.getBestProvider(criteria, true); this.locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { if (location != null) { SubmitActivity.this.videoLocation = location; double lat = location.getLatitude(); double lng = location.getLongitude(); Log.d(LOG_TAG, "lat=" + lat); Log.d(LOG_TAG, "lng=" + lng); TextView locationText = (TextView) findViewById(R.id.locationLabel); locationText.setText("Geo Location: " + String.format("lat=%.2f lng=%.2f", lat, lng)); locationManager.removeUpdates(this); } else { Log.d(LOG_TAG, "location is null"); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }; if (provider != null) { locationManager.requestLocationUpdates(provider, 2000, 10, locationListener); } }
From source file:com.example.angel.parkpanda.MainActivity.java
public Location moveMyPosCamera() { LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return null; }//from ww w .j a v a 2s .co m Location myLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (myLocation == null) { Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); String provider = lm.getBestProvider(criteria, true); myLocation = lm.getLastKnownLocation(provider); } return myLocation; }
From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java
public boolean isLocationEnabled(Context context) { LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); String provider = lm.getBestProvider(new Criteria(), true); return (!TextUtils.isEmpty(provider) && !LocationManager.PASSIVE_PROVIDER.equals(provider)); }