android.location.LocationProvider Java Examples

The following examples show how to use android.location.LocationProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: DevUtils   Author: afkT   File: LocationUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * provider 的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
 * @param provider 提供者
 * @param status   状态
 * @param extras   provider 可选包
 */
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (sListener != null) {
        sListener.onStatusChanged(provider, status, extras);
    }
    switch (status) {
        case LocationProvider.AVAILABLE:
            LogPrintUtils.dTag(TAG, "当前 GPS 状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            LogPrintUtils.dTag(TAG, "当前 GPS 状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            LogPrintUtils.dTag(TAG, "当前 GPS 状态为暂停服务状态");
            break;
    }
}
 
Example #2
Source Project: Android-UtilCode   Author: hoangkien0705   File: LocationUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
 *
 * @param provider 提供者
 * @param status   状态
 * @param extras   provider可选包
 */
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (mListener != null) {
        mListener.onStatusChanged(provider, status, extras);
    }
    switch (status) {
        case LocationProvider.AVAILABLE:
            LogUtils.d("onStatusChanged", "当前GPS状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            LogUtils.d("onStatusChanged", "当前GPS状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            LogUtils.d("onStatusChanged", "当前GPS状态为暂停服务状态");
            break;
    }
}
 
Example #3
Source Project: RxTools-master   Author: duboAndroid   File: RxLocationTool.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
 *
 * @param provider 提供者
 * @param status   状态
 * @param extras   provider可选包
 */
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (mListener != null) {
        mListener.onStatusChanged(provider, status, extras);
    }
    switch (status) {
        case LocationProvider.AVAILABLE:
            Log.d("onStatusChanged", "当前GPS状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            Log.d("onStatusChanged", "当前GPS状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            Log.d("onStatusChanged", "当前GPS状态为暂停服务状态");
            break;
    }
}
 
Example #4
Source Project: AndroidUtilCode   Author: Blankj   File: LocationUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
 *
 * @param provider 提供者
 * @param status   状态
 * @param extras   provider可选包
 */
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (mListener != null) {
        mListener.onStatusChanged(provider, status, extras);
    }
    switch (status) {
        case LocationProvider.AVAILABLE:
            Log.d("LocationUtils", "当前GPS状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            Log.d("LocationUtils", "当前GPS状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            Log.d("LocationUtils", "当前GPS状态为暂停服务状态");
            break;
    }
}
 
Example #5
Source Project: TowerCollector   Author: zamojski   File: CollectorService.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // on Android 10 this callback will never be invoked
    String statusString;
    switch (status) {
        case LocationProvider.AVAILABLE:
            statusString = "AVAILABLE";
            break;
        case LocationProvider.OUT_OF_SERVICE:
            statusString = "OUT_OF_SERVICE";
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            statusString = "TEMPORARILY_UNAVAILABLE";
            break;
        default:
            statusString = "UNKNOWN";
            break;
    }
    Timber.tag(INNER_TAG).d("onStatusChanged(): %s", statusString);
}
 
Example #6
Source Project: tilt-game-android   Author: mediamonks   File: Engine.java    License: MIT License 6 votes vote down vote up
@Override
public void onStatusChanged(final String pProvider, final int pStatus, final Bundle pExtras) {
	switch (pStatus) {
		case LocationProvider.AVAILABLE:
			this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.AVAILABLE, pExtras);
			break;
		case LocationProvider.OUT_OF_SERVICE:
			this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.OUT_OF_SERVICE, pExtras);
			break;
		case LocationProvider.TEMPORARILY_UNAVAILABLE:
			this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.TEMPORARILY_UNAVAILABLE, pExtras);
			break;
		default:
			throw new IllegalArgumentException("Unexpected " + LocationProvider.class.getSimpleName() + ": '" + pStatus + "'.");
	}
}
 
Example #7
Source Project: GPSLogger   Author: BasicAirData   File: GPSApplication.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // This is called when the GPS status changes
    switch (status) {
        case LocationProvider.OUT_OF_SERVICE:
            //Log.w("myApp", "[#] GPSApplication.java - GPS Out of Service");
            gpsunavailablehandler.removeCallbacks(unavailr);            // Cancel the previous unavail countdown handler
            GPSStatus = GPS_OUTOFSERVICE;
            EventBus.getDefault().post(EventBusMSG.UPDATE_FIX);
            //Toast.makeText( getApplicationContext(), "GPS Out of Service", Toast.LENGTH_SHORT).show();
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            //Log.w("myApp", "[#] GPSApplication.java - GPS Temporarily Unavailable");
            gpsunavailablehandler.removeCallbacks(unavailr);            // Cancel the previous unavail countdown handler
            GPSStatus = GPS_TEMPORARYUNAVAILABLE;
            EventBus.getDefault().post(EventBusMSG.UPDATE_FIX);
            //Toast.makeText( getApplicationContext(), "GPS Temporarily Unavailable", Toast.LENGTH_SHORT).show();
            break;
        case LocationProvider.AVAILABLE:
            gpsunavailablehandler.removeCallbacks(unavailr);            // Cancel the previous unavail countdown handler
            //Log.w("myApp", "[#] GPSApplication.java - GPS Available: " + _NumberOfSatellites + " satellites");
            break;
    }
}
 
Example #8
Source Project: sana.mobile   Author: SanaMobile   File: GpsElement.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // Called when the provider status changes.
    Log.d(TAG, "Provider status changed: " + provider + " status: "
            + status);
    if (status == LocationProvider.AVAILABLE) {
        // Do nothing, we should get a location update soon which will
        // disable the listener.
    } else if (status == LocationProvider.OUT_OF_SERVICE ||
            status == LocationProvider.TEMPORARILY_UNAVAILABLE) {
        getLocationButton.setEnabled(true);
        getLocationButton.setText(
                getString(R.string.gps_element_acquire_unavailable));
        locationManager.removeUpdates(locationListener);
    }
}
 
Example #9
Source Project: osmdroid   Author: osmdroid   File: DiagnosticsActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void probeLocation() {
    StringBuilder sb = new StringBuilder();

    List<String> allProviders = lm.getAllProviders();
    for (String s : allProviders) {
        sb.append(s).append("\n");
        LocationProvider provider = lm.getProvider(s);
        sb.append("Name " + provider.getName()).append("\n");
        sb.append("Cell " + provider.requiresCell()).append("\n");
        sb.append("Network " + provider.requiresNetwork()).append("\n");
        sb.append("Satellite " + provider.requiresSatellite()).append("\n");
        sb.append("Altitude " + provider.supportsAltitude()).append("\n");
        sb.append("Bearing " + provider.supportsBearing()).append("\n");
        sb.append("Speed " + provider.supportsSpeed()).append("\n\n");
        //GpsStatus gpsStatus = lm.getGpsStatus(null);
        //gpsStatus.
    }
    output.setText(sb.toString());
}
 
Example #10
Source Project: Androzic   Author: andreynovikov   File: LocationService.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras)
{
	if (enableMockLocations)
		return;

	if (LocationManager.GPS_PROVIDER.equals(provider))
	{
		switch (status)
		{
			case LocationProvider.TEMPORARILY_UNAVAILABLE:
			case LocationProvider.OUT_OF_SERVICE:
				tearTrack();
				updateNotification();
				break;
		}
	}
}
 
Example #11
Source Project: mollyim-android   Author: mollyim   File: LocationRetriever.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onStart(@NonNull LifecycleOwner owner) {
  if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
      ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
  {
    Log.w(TAG, "No location permission!");
    failureListener.onFailure();
  }

  LocationProvider provider = locationManager.getProvider(LocationManager.GPS_PROVIDER);

  if (provider == null) {
    Log.w(TAG, "GPS provider is null. Trying network provider.");
    provider = locationManager.getProvider(LocationManager.NETWORK_PROVIDER);
  }

  if (provider == null) {
    Log.w(TAG, "Network provider is null. Unable to retrieve location.");
    failureListener.onFailure();
    return;
  }

  Location lastKnown = locationManager.getLastKnownLocation(provider.getName());

  if (lastKnown != null) {
    Log.i(TAG, "Using last known location.");
    successListener.onSuccess(lastKnown);
  } else {
    Log.i(TAG, "No last known location. Requesting a single update.");
    locationManager.requestSingleUpdate(provider.getName(), this, null);
  }
}
 
Example #12
Source Project: android_9.0.0_r45   Author: lulululbj   File: LocationManagerService.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return all providers by name, that match criteria and are optionally
 * enabled.
 * Can return passive provider, but never returns fused provider.
 */
@Override
public List<String> getProviders(Criteria criteria, boolean enabledOnly) {
    int allowedResolutionLevel = getCallerAllowedResolutionLevel();
    ArrayList<String> out;
    int uid = Binder.getCallingUid();
    long identity = Binder.clearCallingIdentity();
    try {
        synchronized (mLock) {
            out = new ArrayList<>(mProviders.size());
            for (LocationProviderInterface provider : mProviders) {
                String name = provider.getName();
                if (LocationManager.FUSED_PROVIDER.equals(name)) {
                    continue;
                }
                if (allowedResolutionLevel >= getMinimumResolutionLevelForProviderUse(name)) {
                    if (enabledOnly
                            && !isAllowedByUserSettingsLocked(name, uid, mCurrentUserId)) {
                        continue;
                    }
                    if (criteria != null && !LocationProvider.propertiesMeetCriteria(
                            name, provider.getProperties(), criteria)) {
                        continue;
                    }
                    out.add(name);
                }
            }
        }
    } finally {
        Binder.restoreCallingIdentity(identity);
    }

    if (D) Log.d(TAG, "getProviders()=" + out);
    return out;
}
 
Example #13
Source Project: android_9.0.0_r45   Author: lulululbj   File: LocationManagerService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean providerMeetsCriteria(String provider, Criteria criteria) {
    LocationProviderInterface p = mProvidersByName.get(provider);
    if (p == null) {
        throw new IllegalArgumentException("provider=" + provider);
    }

    boolean result = LocationProvider.propertiesMeetCriteria(
            p.getName(), p.getProperties(), criteria);
    if (D) Log.d(TAG, "providerMeetsCriteria(" + provider + ", " + criteria + ")=" + result);
    return result;
}
 
Example #14
Source Project: android_9.0.0_r45   Author: lulululbj   File: PassiveProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int getStatus(Bundle extras) {
    if (mReportLocation) {
        return LocationProvider.AVAILABLE;
    } else {
        return LocationProvider.TEMPORARILY_UNAVAILABLE;
    }
}
 
Example #15
Source Project: android_9.0.0_r45   Author: lulululbj   File: MockProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int getStatus(Bundle extras) {
    if (mHasStatus) {
        extras.clear();
        extras.putAll(mExtras);
        return mStatus;
    } else {
        return LocationProvider.AVAILABLE;
    }
}
 
Example #16
Source Project: android_9.0.0_r45   Author: lulululbj   File: GnssLocationProvider.java    License: Apache License 2.0 5 votes vote down vote up
private void stopNavigating() {
    if (DEBUG) Log.d(TAG, "stopNavigating");
    if (mStarted) {
        mStarted = false;
        mSingleShot = false;
        native_stop();
        mLastFixTime = 0;

        // reset SV count to zero
        updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE);
        mLocationExtras.reset();
    }
}
 
Example #17
Source Project: react-native-GPay   Author: hellochirag   File: LocationModule.java    License: MIT License 5 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
  if (status == LocationProvider.OUT_OF_SERVICE) {
    emitError(PositionError.POSITION_UNAVAILABLE, "Provider " + provider + " is out of service.");
  } else if (status == LocationProvider.TEMPORARILY_UNAVAILABLE) {
    emitError(PositionError.TIMEOUT, "Provider " + provider + " is temporarily unavailable.");
  }
}
 
Example #18
Source Project: mapbox-events-android   Author: mapbox   File: MapboxFusedLocationEngineImplAdditionalTest2.java    License: MIT License 5 votes vote down vote up
@Before
public void setUp() {
  location = mock(Location.class);
  when(location.getLatitude()).thenReturn(1.0);
  when(location.getLongitude()).thenReturn(2.0);
  Context mockContext = mock(Context.class);
  mockLocationManager = mock(LocationManager.class);
  when(mockContext.getSystemService(anyString())).thenReturn(mockLocationManager);
  List<String> providers = new ArrayList<>();
  providers.add(PROVIDER);
  when(mockLocationManager.getAllProviders()).thenReturn(providers);
  when(mockLocationManager.getBestProvider(any(Criteria.class), anyBoolean()))
    .thenReturn(LocationManager.GPS_PROVIDER);
  doAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) {
      LocationListener listener = (LocationListener) invocation.getArguments()[3];
      listener.onProviderEnabled(PROVIDER);
      listener.onStatusChanged(PROVIDER, LocationProvider.AVAILABLE, null);
      listener.onLocationChanged(location);
      listener.onProviderDisabled(PROVIDER);
      return null;
    }
  }).when(mockLocationManager)
    .requestLocationUpdates(anyString(), anyLong(), anyFloat(), any(LocationListener.class), any(Looper.class));
  engines.add(new LocationEngineProxy<>(new MapboxFusedLocationEngineImpl(mockContext)));
  engines.add(new LocationEngineProxy<>(new AndroidLocationEngineImpl(mockContext)));
}
 
Example #19
Source Project: VirtualLocation   Author: littleRich   File: LocationUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 配置LocationManger参数
 */
public static void initLocationManager() throws Exception{
    if (canMockPosition && !hasAddTestProvider) {
        try {
            String providerStr = LocationManager.GPS_PROVIDER;
            LocationProvider provider = locationManager.getProvider(providerStr);
            if (provider != null) {
                locationManager.addTestProvider(
                        provider.getName()
                        , provider.requiresNetwork()
                        , provider.requiresSatellite()
                        , provider.requiresCell()
                        , provider.hasMonetaryCost()
                        , provider.supportsAltitude()
                        , provider.supportsSpeed()
                        , provider.supportsBearing()
                        , provider.getPowerRequirement()
                        , provider.getAccuracy());
            } else {
                locationManager.addTestProvider(
                        providerStr
                        , true, true, false, false, true, true, true
                        , Criteria.POWER_HIGH
                        , Criteria.ACCURACY_FINE);
            }
            locationManager.setTestProviderEnabled(providerStr, true);
            locationManager.requestLocationUpdates(providerStr, 0, 0, new LocationStatuListener());
            locationManager.setTestProviderStatus(providerStr, LocationProvider.AVAILABLE, null, System.currentTimeMillis());
            Log.i(TAG,"already open GPS!");
            // 模拟位置可用
            hasAddTestProvider = true;
            Log.d(TAG, "hasAddTestProvider:" + hasAddTestProvider);
            canMockPosition = true;
        } catch (Exception e) {
            canMockPosition = false;
            Log.d(TAG, "初始化异常:" + e);
            throw  e;
        }
    }
}
 
Example #20
Source Project: apollo-DuerOS   Author: ApolloAuto   File: GPSListenersMaker.java    License: Apache License 2.0 5 votes vote down vote up
public void onStatusChanged(String provider, int status, Bundle extras) {
    switch (status) {
        case LocationProvider.AVAILABLE:
            break;
        case LocationProvider.OUT_OF_SERVICE:
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            break;
        default:
            break;
    }
}
 
Example #21
Source Project: appinventor-extensions   Author: mit-cml   File: LocationSensor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
  switch (status) {
    // Ignore TEMPORARILY_UNAVAILABLE, because service usually returns quickly.
    case LocationProvider.TEMPORARILY_UNAVAILABLE:
      StatusChanged(provider, "TEMPORARILY_UNAVAILABLE");
      break;
    case LocationProvider.OUT_OF_SERVICE:
      // If the provider we were listening to is no longer available,
      // find another.
      StatusChanged(provider, "OUT_OF_SERVICE");

      if (provider.equals(providerName)) {
        stopListening();
        RefreshProvider("onStatusChanged");
      }
      break;
    case LocationProvider.AVAILABLE:
      // If another provider becomes available and is one we hadn't known
      // about see if it is better than the one we're currently using.
      StatusChanged(provider, "AVAILABLE");
      if (!provider.equals(providerName) &&
          !allProviders.contains(provider)) {
        RefreshProvider("onStatusChanged");
      }
      break;
  }
}
 
Example #22
Source Project: appinventor-extensions   Author: mit-cml   File: LocationSensor.java    License: Apache License 2.0 5 votes vote down vote up
private boolean startProvider(final String providerName) {
  this.providerName = providerName;
  LocationProvider tLocationProvider = locationManager.getProvider(providerName);
  if (tLocationProvider == null) {
    Log.d(LOG_TAG, "getProvider(" + providerName + ") returned null");
    return false;
  }
  stopListening();
  locationProvider = tLocationProvider;
  locationManager.requestLocationUpdates(providerName, timeInterval,
        distanceInterval, myLocationListener);
  listening = true;
  return true;
}
 
Example #23
Source Project: AndroidLocationStarterKit   Author: mizutori   File: LocationService.java    License: MIT License 5 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (provider.equals(LocationManager.GPS_PROVIDER)) {
        if (status == LocationProvider.OUT_OF_SERVICE) {
            notifyLocationProviderStatusUpdated(false);
        } else {
            notifyLocationProviderStatusUpdated(true);
        }
    }
}
 
Example #24
Source Project: trekarta   Author: andreynovikov   File: LocationService.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    if (enableMockLocations && BuildConfig.DEBUG)
        return;

    if (LocationManager.GPS_PROVIDER.equals(provider)) {
        switch (status) {
            case LocationProvider.TEMPORARILY_UNAVAILABLE:
            case LocationProvider.OUT_OF_SERVICE:
                tearTrack();
                updateNotification();
                break;
        }
    }
}
 
Example #25
Source Project: mappwidget   Author: lemberg   File: GPSLocationProvider.java    License: Apache License 2.0 5 votes vote down vote up
private String statusToString(int status)
{
	switch (status) {
	case LocationProvider.OUT_OF_SERVICE:
		return "OUT_OF_SERVICE";
	case LocationProvider.TEMPORARILY_UNAVAILABLE:
		return "TEMPORARILY_UNAVAILABLE";
	case LocationProvider.AVAILABLE:
		return "AVAILABLE:";
	}
	
	return "UNKNOWN";
}
 
Example #26
Source Project: MiBandDecompiled   Author: vishnudevk   File: LocationProviderProxy.java    License: Apache License 2.0 5 votes vote down vote up
private LocationProvider a()
{
    LocationProvider locationprovider;
    if (a == null)
    {
        break MISSING_BLOCK_LABEL_26;
    }
    locationprovider = a.getProvider(b);
    return locationprovider;
    Throwable throwable;
    throwable;
    throwable.printStackTrace();
    return null;
}
 
Example #27
Source Project: CodenameOne   Author: codenameone   File: AndroidLocationManager.java    License: GNU General Public License v2.0 5 votes vote down vote up
private String findProvider(boolean includeNetwork) {
    String providerName = null;
    Criteria criteria = new Criteria();
    criteria.setSpeedRequired(true);
    criteria.setAltitudeRequired(true);

    LocationProvider provider;
    boolean enabled;

    if (includeNetwork) {
        provider = locationManager.getProvider(LocationManager.NETWORK_PROVIDER);
        enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        if (provider != null && enabled) {
            providerName = provider.getName();
        } else {
            providerName = locationManager.getBestProvider(criteria, true);
        }
    }

    if (providerName == null) {
        // If GPS provider, then create and start GPS listener
        provider = locationManager.getProvider(LocationManager.GPS_PROVIDER);
        enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        if (provider != null && enabled) {
            providerName = provider.getName();
        }
    }
    return providerName;
}
 
Example #28
Source Project: CodenameOne   Author: codenameone   File: AndroidLocationManager.java    License: GNU General Public License v2.0 5 votes vote down vote up
private int convertStatus(int status) {
    switch (status) {
        case LocationProvider.AVAILABLE:
            return com.codename1.location.LocationManager.AVAILABLE;
        case LocationProvider.OUT_OF_SERVICE:
            return com.codename1.location.LocationManager.OUT_OF_SERVICE;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            return com.codename1.location.LocationManager.TEMPORARILY_UNAVAILABLE;
    }
    return com.codename1.location.LocationManager.OUT_OF_SERVICE;
}
 
Example #29
Source Project: sensorhub   Author: sensiasoft   File: SensorMLBuilder.java    License: Mozilla Public License 2.0 5 votes vote down vote up
public PhysicalComponent getComponentDescription(LocationManager locManager, LocationProvider locProvider)
{
    PhysicalComponent comp = smlFac.newPhysicalComponent();
    comp.setId("LOC_" + formatId(locProvider.getName()));
    comp.setName(locProvider.getName());
    return comp;
}
 
Example #30
Source Project: sensorhub   Author: sensiasoft   File: AndroidLocationOutput.java    License: Mozilla Public License 2.0 5 votes vote down vote up
protected AndroidLocationOutput(AndroidSensorsDriver parentModule, LocationManager locManager, LocationProvider locProvider)
{
    super(parentModule);
    this.locManager = locManager;
    this.locProvider = locProvider;        
    this.name = locProvider.getName().replaceAll(" ", "_") + "_data";
}