List of usage examples for android.location LocationManager GPS_PROVIDER
String GPS_PROVIDER
To view the source code for android.location LocationManager GPS_PROVIDER.
Click Source Link
From source file:com.landenlabs.all_devtool.GpsFragment.java
private void showProviders() { GpsInfo gpsInfo = m_list.get(s_providersRow); ItemList itemList = gpsInfo.getList(); itemList.clear();/*from w w w .j a va 2 s . c o m*/ List<String> gpsProviders = m_locMgr.getAllProviders(); int idx = 1; for (String providerName : gpsProviders) { if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { try { LocationProvider provider = m_locMgr.getProvider(providerName); if (null != provider) { int color = getProviderColor(providerName); String msg = String.format("%-10s %3s Accuracy:%d Pwr:%d", providerName, (m_locMgr.isProviderEnabled(providerName) ? "On" : "Off"), provider.getAccuracy(), provider.getPowerRequirement()); itemList.add(new GpsItem(s_noTime, msg, color)); } } catch (SecurityException ex) { m_log.e(ex.getLocalizedMessage()); m_gpsTv.setEnabled(false); addMsgToDetailRow(s_colorMsg, "GPS not available"); addMsgToDetailRow(s_colorMsg, ex.getLocalizedMessage()); } } } listChanged(); if (m_locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER)) m_statusIcon.setImageResource(R.drawable.gps_satellite); else if (m_locMgr.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) m_statusIcon.setImageResource(R.drawable.gps_tower); else if (m_locMgr.isProviderEnabled(LocationManager.PASSIVE_PROVIDER)) m_statusIcon.setImageResource(R.drawable.gps_passive); else m_statusIcon.setImageResource(R.drawable.gps_off); }
From source file:com.mjhram.geodata.GpsLoggingService.java
/** * Starts the location manager. There are two location managers - GPS and * Cell Tower. This code determines which manager to request updates from * based on user preference and whichever is enabled. If GPS is enabled on * the phone, that is used. But if the user has also specified that they * prefer cell towers, then cell towers are used. If neither is enabled, * then nothing is requested./* ww w . jav a 2 s.c om*/ */ private void StartGpsManager() { //If the user has been still for more than the minimum seconds if (userHasBeenStillForTooLong()) { tracer.info("No movement detected in the past interval, will not log"); SetAlarmForNextPoint(); return; } if (gpsLocationListener == null) { gpsLocationListener = new GeneralLocationListener(this, "GPS"); } if (towerLocationListener == null) { towerLocationListener = new GeneralLocationListener(this, "CELL"); } gpsLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); towerLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); CheckTowerAndGpsStatus(); if (Session.isGpsEnabled() && AppSettings.getChosenListeners().contains("gps")) { tracer.info("Requesting GPS location updates"); // gps satellite based gpsLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, gpsLocationListener); gpsLocationManager.addGpsStatusListener(gpsLocationListener); //gpsLocationManager.addNmeaListener(gpsLocationListener); Session.setUsingGps(true); startAbsoluteTimer(); } if (Session.isTowerEnabled() && (AppSettings.getChosenListeners().contains("network") || !Session.isGpsEnabled())) { tracer.info("Requesting cell and wifi location updates"); Session.setUsingGps(false); // Cell tower and wifi based towerLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, towerLocationListener); startAbsoluteTimer(); } if (!Session.isTowerEnabled() && !Session.isGpsEnabled()) { tracer.error("No provider available!"); Session.setUsingGps(false); tracer.error(getString(R.string.gpsprovider_unavailable)); //StopLogging(); SetLocationServiceUnavailable(); return; } EventBus.getDefault().post(new ServiceEvents.WaitingForLocation(true)); Session.setWaitingForLocation(true); }
From source file:com.raddapp.radika.raddappv001.GpsLoggingService.java
/** * Starts the location manager. There are two location managers - GPS and * Cell Tower. This code determines which manager to request updates from * based on user preference and whichever is enabled. If GPS is enabled on * the phone, that is used. But if the user has also specified that they * prefer cell towers, then cell towers are used. If neither is enabled, * then nothing is requested.//from www . j a v a2s . c o m */ private void StartGpsManager() { Log.d("GPSLOGSERV 101", "StartGpsManager"); //If the user has been still for more than the minimum seconds if (userHasBeenStillForTooLong()) { //tracer.info("No movement detected in the past interval, will not log"); SetAlarmForNextPoint(); return; } if (gpsLocationListener == null) { gpsLocationListener = new GeneralLocationListener(this, "GPS"); } if (towerLocationListener == null) { towerLocationListener = new GeneralLocationListener(this, "CELL"); } gpsLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); towerLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); CheckTowerAndGpsStatus(); if (Session.isGpsEnabled()) { // && AppSettings.getChosenListeners().contains("gps") //tracer.info("Requesting GPS location updates"); // gps satellite based gpsLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, gpsLocationListener); gpsLocationManager.addGpsStatusListener(gpsLocationListener); // gpsLocationManager.addNmeaListener(gpsLocationListener); Session.setUsingGps(true); startAbsoluteTimer(); } /*if (Session.isTowerEnabled() && ( AppSettings.getChosenListeners().contains("network") || !Session.isGpsEnabled() ) ) { tracer.info("Requesting cell and wifi location updates"); Session.setUsingGps(false); // Cell tower and wifi based towerLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, towerLocationListener); startAbsoluteTimer(); }*/ if (!Session.isTowerEnabled() && !Session.isGpsEnabled()) { //tracer.error("No provider available!"); Session.setUsingGps(false); //tracer.error("GPS unavaiable");//getString(R.string.gpsprovider_unavailable) StopLogging(); SetLocationServiceUnavailable(); return; } //EventBus.getDefault().post(new ServiceEvents.WaitingForLocation(true)); Session.setWaitingForLocation(true); }
From source file:com.androzic.location.LocationService.java
private void updateProvider(final String provider, final boolean enabled) { if (LocationManager.GPS_PROVIDER.equals(provider)) updateNotification();//from ww w .ja v a2 s .c o m final Handler handler = new Handler(); for (final ILocationListener callback : locationCallbacks) { handler.post(new Runnable() { @Override public void run() { if (enabled) callback.onProviderEnabled(provider); else callback.onProviderDisabled(provider); } }); } final int n = locationRemoteCallbacks.beginBroadcast(); for (int i = 0; i < n; i++) { final ILocationCallback callback = locationRemoteCallbacks.getBroadcastItem(i); try { if (enabled) callback.onProviderEnabled(provider); else callback.onProviderDisabled(provider); } catch (RemoteException e) { Log.e(TAG, "Provider broadcast error", e); } } locationRemoteCallbacks.finishBroadcast(); Log.d(TAG, "Provider status dispatched: " + (locationCallbacks.size() + n)); }
From source file:com.example.angel.parkpanda.MainActivity.java
public Location getLocation() { Location location = null;/*from w w w.j a v a 2s . c o m*/ LocationManager locationManager; boolean isGPSEnabled = false; boolean isNetworkEnabled = false; final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; double longitude, latitude; long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; try { locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled && !isNetworkEnabled) { // no network provider is enabled } else { if (isNetworkEnabled) { 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; } locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } // if GPS Enabled get lat/long using GPS Services if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } } } } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); } return location; }
From source file:com.trailbehind.android.iburn.map.MapActivity.java
/** * Check gps provider./*from ww w . java 2s .c o m*/ */ private void checkGPSProvider() { final LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { mProgressBar.setVisibility(View.GONE); mMessageTextView.setText(R.string.error_gps_disabled); mMessageTextView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { mVibrator.vibrate(50); final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent); } catch (Exception e) { // we dont care } } }); UIUtils.showPanel(getBaseContext(), mMessagePanel, false); } else if (Globals.sCurrentGPSLocation == null) { mProgressBar.setVisibility(View.VISIBLE); mMessageTextView.setText(R.string.msg_locating); UIUtils.showPanel(getBaseContext(), mMessagePanel, false); } else { UIUtils.hidePanel(getBaseContext(), mMessagePanel, false); } }
From source file:eu.basicairdata.graziano.gpslogger.GPSApplication.java
public void updateGPSLocationFrequency() { if (isGPSLocationUpdatesActive && (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mlocManager.removeGpsStatusListener(this); mlocManager.removeUpdates(this); StabilizingSamples = (int) Math.ceil(STABILIZERVALUE / prefGPSupdatefrequency); mlocManager.addGpsStatusListener(this); mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, prefGPSupdatefrequency, 0, this); }//w w w . j a v a 2 s. c om }
From source file:com.vonglasow.michael.satstat.MapSectionFragment.java
/** * Updates the list of styles to use for the location providers. * /*from ww w. j a v a 2 s .c o m*/ * This method updates the internal list of styles to use for displaying * locations on the map, assigning a style to each location provider. * Styles that are defined in {@link SharedPreferences} are preserved. If * none are defined, the GPS location provider is assigned the red style * and the network location provider is assigned the blue style. The * passive location provider is not assigned a style, as it does not send * any locations of its own. Other location providers are assigned one of * the following styles: green, orange, purple. If there are more location * providers than styles, the same style (including red and blue) can be * assigned to multiple providers. The mapping is written to * SharedPreferences so that it will be preserved even as available * location providers change. */ public void updateLocationProviderStyles() { //FIXME: move code into assignLocationProviderStyle and use that List<String> allProviders = mainActivity.locationManager.getAllProviders(); allProviders.remove(LocationManager.PASSIVE_PROVIDER); if (allProviders.contains(LocationManager.GPS_PROVIDER)) { providerStyles.put(LocationManager.GPS_PROVIDER, mainActivity.mSharedPreferences.getString( SettingsActivity.KEY_PREF_LOC_PROV_STYLE + LocationManager.GPS_PROVIDER, LOCATION_PROVIDER_RED)); mAvailableProviderStyles.remove(LOCATION_PROVIDER_RED); allProviders.remove(LocationManager.GPS_PROVIDER); } if (allProviders.contains(LocationManager.NETWORK_PROVIDER)) { providerStyles.put(LocationManager.NETWORK_PROVIDER, mainActivity.mSharedPreferences.getString( SettingsActivity.KEY_PREF_LOC_PROV_STYLE + LocationManager.NETWORK_PROVIDER, LOCATION_PROVIDER_BLUE)); mAvailableProviderStyles.remove(LOCATION_PROVIDER_BLUE); allProviders.remove(LocationManager.NETWORK_PROVIDER); } for (String prov : allProviders) { if (mAvailableProviderStyles.isEmpty()) mAvailableProviderStyles.addAll(Arrays.asList(LOCATION_PROVIDER_STYLES)); providerStyles.put(prov, mainActivity.mSharedPreferences .getString(SettingsActivity.KEY_PREF_LOC_PROV_STYLE + prov, mAvailableProviderStyles.get(0))); mAvailableProviderStyles.remove(providerStyles.get(prov)); } ; SharedPreferences.Editor spEditor = mainActivity.mSharedPreferences.edit(); for (String prov : providerStyles.keySet()) spEditor.putString(SettingsActivity.KEY_PREF_LOC_PROV_STYLE + prov, providerStyles.get(prov)); spEditor.commit(); }
From source file:com.androzic.MapActivity.java
@Override protected void onResume() { super.onResume(); Log.e(TAG, "onResume()"); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); Resources resources = getResources(); // update some preferences int speedIdx = Integer.parseInt(settings.getString(getString(R.string.pref_unitspeed), "0")); speedFactor = Double.parseDouble(resources.getStringArray(R.array.speed_factors)[speedIdx]); speedAbbr = resources.getStringArray(R.array.speed_abbrs)[speedIdx]; speedUnit.setText(speedAbbr);//from w w w . j a v a2s . c o m int distanceIdx = Integer.parseInt(settings.getString(getString(R.string.pref_unitdistance), "0")); StringFormatter.distanceFactor = Double .parseDouble(resources.getStringArray(R.array.distance_factors)[distanceIdx]); StringFormatter.distanceAbbr = resources.getStringArray(R.array.distance_abbrs)[distanceIdx]; StringFormatter.distanceShortFactor = Double .parseDouble(resources.getStringArray(R.array.distance_factors_short)[distanceIdx]); StringFormatter.distanceShortAbbr = resources.getStringArray(R.array.distance_abbrs_short)[distanceIdx]; int elevationIdx = Integer.parseInt(settings.getString(getString(R.string.pref_unitelevation), "0")); elevationFactor = Double.parseDouble(resources.getStringArray(R.array.elevation_factors)[elevationIdx]); elevationAbbr = resources.getStringArray(R.array.elevation_abbrs)[elevationIdx]; elevationUnit.setText(elevationAbbr); application.angleType = Integer.parseInt(settings.getString(getString(R.string.pref_unitangle), "0")); trackUnit.setText((application.angleType == 0 ? "deg" : getString(R.string.degmag))); bearingUnit.setText((application.angleType == 0 ? "deg" : getString(R.string.degmag))); application.coordinateFormat = Integer .parseInt(settings.getString(getString(R.string.pref_unitcoordinate), "0")); application.sunriseType = Integer.parseInt(settings.getString(getString(R.string.pref_unitsunrise), "0")); renderInterval = settings.getInt(getString(R.string.pref_maprenderinterval), resources.getInteger(R.integer.def_maprenderinterval)) * 100; followOnLocation = settings.getBoolean(getString(R.string.pref_mapfollowonloc), resources.getBoolean(R.bool.def_mapfollowonloc)); magInterval = resources.getInteger(R.integer.def_maginterval) * 1000; showDistance = Integer.parseInt(settings.getString(getString(R.string.pref_showdistance_int), getString(R.string.def_showdistance))); showAccuracy = settings.getBoolean(getString(R.string.pref_showaccuracy), true); autoDim = settings.getBoolean(getString(R.string.pref_mapdim), resources.getBoolean(R.bool.def_mapdim)); dimInterval = settings.getInt(getString(R.string.pref_mapdiminterval), resources.getInteger(R.integer.def_mapdiminterval)) * 1000; dimValue = settings.getInt(getString(R.string.pref_mapdimvalue), resources.getInteger(R.integer.def_mapdimvalue)); map.setHideOnDrag(settings.getBoolean(getString(R.string.pref_maphideondrag), resources.getBoolean(R.bool.def_maphideondrag))); map.setStrictUnfollow(!settings.getBoolean(getString(R.string.pref_unfollowontap), resources.getBoolean(R.bool.def_unfollowontap))); map.setLookAhead( settings.getInt(getString(R.string.pref_lookahead), resources.getInteger(R.integer.def_lookahead))); map.setBestMapEnabled( settings.getBoolean(getString(R.string.pref_mapbest), resources.getBoolean(R.bool.def_mapbest))); map.setBestMapInterval(settings.getInt(getString(R.string.pref_mapbestinterval), resources.getInteger(R.integer.def_mapbestinterval)) * 1000); map.setCursorVector( Integer.parseInt(settings.getString(getString(R.string.pref_cursorvector), getString(R.string.def_cursorvector))), settings.getInt(getString(R.string.pref_cursorvectormlpr), resources.getInteger(R.integer.def_cursorvectormlpr))); map.setProximity(Integer.parseInt(settings.getString(getString(R.string.pref_navigation_proximity), getString(R.string.def_navigation_proximity)))); // prepare views customizeLayout(settings); findViewById(R.id.editroute).setVisibility(application.editingRoute != null ? View.VISIBLE : View.GONE); if (application.editingTrack != null) { startEditTrack(application.editingTrack); } updateGPSStatus(); updateNavigationStatus(); // prepare overlays updateOverlays(settings, false); if (settings.getBoolean(getString(R.string.ui_drawer_open), false)) { Panel panel = (Panel) findViewById(R.id.panel); panel.setOpen(true, false); } onSharedPreferenceChanged(settings, getString(R.string.pref_wakelock)); map.setKeepScreenOn(keepScreenOn); // TODO move into application if (lastKnownLocation != null) { if (lastKnownLocation.getProvider().equals(LocationManager.GPS_PROVIDER)) { updateMovingInfo(lastKnownLocation, true); updateNavigationInfo(); dimScreen(lastKnownLocation); } else if (lastKnownLocation.getProvider().equals(LocationManager.NETWORK_PROVIDER)) { dimScreen(lastKnownLocation); } } bindService(new Intent(this, LocationService.class), locationConnection, BIND_AUTO_CREATE); bindService(new Intent(this, NavigationService.class), navigationConnection, BIND_AUTO_CREATE); registerReceiver(broadcastReceiver, new IntentFilter(NavigationService.BROADCAST_NAVIGATION_STATUS)); registerReceiver(broadcastReceiver, new IntentFilter(NavigationService.BROADCAST_NAVIGATION_STATE)); registerReceiver(broadcastReceiver, new IntentFilter(LocationService.BROADCAST_LOCATING_STATUS)); registerReceiver(broadcastReceiver, new IntentFilter(LocationService.BROADCAST_TRACKING_STATUS)); registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF)); registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON)); if (application.hasEnsureVisible()) { setFollowing(false); double[] loc = application.getEnsureVisible(); application.setMapCenter(loc[0], loc[1], true, false); application.clearEnsureVisible(); } else { application.updateLocationMaps(true, map.isBestMapEnabled()); } updateMapViewArea(); map.resume(); map.updateMapInfo(); map.update(); map.requestFocus(); }
From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java
@Override protected void onResume() { super.onResume(); try {// w w w . ja v a2 s.com 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; } }