当前位置: 首页>>代码示例>>Java>>正文


Java LocationProvider类代码示例

本文整理汇总了Java中android.location.LocationProvider的典型用法代码示例。如果您正苦于以下问题:Java LocationProvider类的具体用法?Java LocationProvider怎么用?Java LocationProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LocationProvider类属于android.location包,在下文中一共展示了LocationProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
/**
 * 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(TAG, "当前GPS状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            Log.d(TAG, "当前GPS状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            Log.d(TAG, "当前GPS状态为暂停服务状态");
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:LocationUtils.java

示例2: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:25,代码来源:LocationUtils.java

示例3: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
/**
 * 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:
            Logger.d("onStatusChanged", "当前GPS状态为可见状态");
            break;
        case LocationProvider.OUT_OF_SERVICE:
            Logger.d("onStatusChanged", "当前GPS状态为服务区外状态");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            Logger.d("onStatusChanged", "当前GPS状态为暂停服务状态");
            break;
    }
}
 
开发者ID:penghongru,项目名称:Coder,代码行数:25,代码来源:LocationUtils.java

示例4: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    LogHelper.debugLog("\"" + this.getClass().getName() + "\" onStatusChanged");

    switch (status) {
        case LocationProvider.OUT_OF_SERVICE:
            LogHelper.infoLog("\"" + provider + "\" provider status changed: Out of service");
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            LogHelper.infoLog("\"" + provider + "\" provider status changed: Temporarily unavailable");
            break;
        case LocationProvider.AVAILABLE:
            LogHelper.infoLog("\"" + provider + "\" provider status changed: Available");
            break;
    }
}
 
开发者ID:n37bl4d3,项目名称:Android-Location-Tracker,代码行数:17,代码来源:LocationService.java

示例5: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:Blankj,项目名称:AndroidUtilCode,代码行数:25,代码来源:LocationUtils.java

示例6: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
public void onStatusChanged(String provider, int status, Bundle extras) {
	switch (status) {
	// GPS状态为可见时
	case LocationProvider.AVAILABLE:
		Log.i(TAG, "simpleGPS 当前GPS状态为可见状态");
		break;
	// GPS状态为服务区外时
	case LocationProvider.OUT_OF_SERVICE:
		Log.i(TAG, "当前GPS状态为服务区外状态");
		break;
	// GPS状态为暂停服务时
	case LocationProvider.TEMPORARILY_UNAVAILABLE:
		Log.i(TAG, "当前GPS状态为暂停服务状态");
		break;
	}

}
 
开发者ID:wuwenjie1992,项目名称:FakeGPS,代码行数:18,代码来源:GPSWriteService.java

示例7: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:vondear,项目名称:RxTools,代码行数:25,代码来源:RxLocationTool.java

示例8: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    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;
    }
    Log.d(INNER_TAG, String.format("onStatusChanged(): %s", statusString));
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:20,代码来源:CollectorService.java

示例9: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
	Log.i(TAG, "onStatusChanged() Status=" + status);

	if (listener != null)
		switch (status) {
		case LocationProvider.AVAILABLE:
			listener.onProviderAvailable();
			break;
		case LocationProvider.OUT_OF_SERVICE:
			locationManager.removeUpdates(locationListener);
			listener.onProviderUnavailable();
			break;
		case LocationProvider.TEMPORARILY_UNAVAILABLE:
			locationManager.removeUpdates(locationListener);
			listener.onProviderUnavailable();
			break;
		}
}
 
开发者ID:mirhoseini,项目名称:android_utils,代码行数:20,代码来源:LocationHelper.java

示例10: begin

import android.location.LocationProvider; //导入依赖的package包/类
public void begin()
{
    LocationManager lm = (LocationManager) ctx.getSystemService(
            Context.LOCATION_SERVICE);

    lm.addTestProvider(
            providerName,
            REQUIRES_NETWORK,
            REQUIRES_SATELLITE,
            REQUIRES_CELL,
            HAS_MONETARY_COST,
            SUPPORTS_ALTITUDE,
            SUPPORTS_SPEED,
            SUPPORTS_BEARING,
            Criteria.ACCURACY_LOW, Criteria.ACCURACY_FINE
    );

    lm.setTestProviderEnabled(providerName, true);
    lm.setTestProviderStatus(
            LocationManager.GPS_PROVIDER,
            LocationProvider.AVAILABLE,
            null,
            System.currentTimeMillis());
}
 
开发者ID:panda73111,项目名称:FakeLocation,代码行数:25,代码来源:MockLocationProvider.java

示例11: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    String statusStr = null;
    switch (status) {
        case LocationProvider.OUT_OF_SERVICE:
            statusStr = "OUT_OF_SERVICE";
            break;
        case LocationProvider.TEMPORARILY_UNAVAILABLE:
            statusStr = "TEMPORARILY_UNAVAILABLE";
            break;
        case LocationProvider.AVAILABLE:
            statusStr = "AVAILABLE";
            break;
    }
    Log.v(TAG, "onStatusChange(" + provider + ", " + statusStr + ")");
}
 
开发者ID:samuel22gj,项目名称:OtterBenchmark,代码行数:17,代码来源:GpsMonitor.java

示例12: activate

import android.location.LocationProvider; //导入依赖的package包/类
@Override
public void activate(OnLocationChangedListener listener) {
	this.listener = listener;
	LocationProvider gpsProvider = locationManager
			.getProvider(LocationManager.GPS_PROVIDER);
	if (gpsProvider != null) {
		locationManager.requestLocationUpdates(gpsProvider.getName(),
				10, 100, this);
	}

	LocationProvider networkProvider = locationManager
			.getProvider(LocationManager.NETWORK_PROVIDER);

	if (networkProvider != null) {
		locationManager.requestLocationUpdates(
				LocationManager.NETWORK_PROVIDER, 1000 * 60 * 5, 0,
				this);
	}
}
 
开发者ID:himanshuagarwal77225,项目名称:BookMySkills,代码行数:20,代码来源:MySupportMapFragment.java

示例13: AndroidLocationOutput

import android.location.LocationProvider; //导入依赖的package包/类
protected AndroidLocationOutput(AndroidSensorsDriver parentModule, LocationManager locManager, LocationProvider locProvider)
{
    super(parentModule);
    this.locManager = locManager;
    this.locProvider = locProvider;        
    this.name = locProvider.getName().replaceAll(" ", "_") + "_data";
    
    // output structure (time + location)
    GeoPosHelper fac = new GeoPosHelper();
    posDataStruct = fac.newDataRecord(2);
    posDataStruct.setName(getName());
    Time time = fac.newTimeStampIsoUTC();
    posDataStruct.addComponent("time", time);
    Vector vec = fac.newLocationVectorLLA(null);  
    ((Vector)vec).setLocalFrame(parentSensor.localFrameURI);
    posDataStruct.addComponent("location", vec);
    
    // output encoding
    posEncoding = fac.newTextEncoding(",", "\n");
}
 
开发者ID:opensensorhub,项目名称:osh-android,代码行数:21,代码来源:AndroidLocationOutput.java

示例14: positioningMethods

import android.location.LocationProvider; //导入依赖的package包/类
private long positioningMethods (String provider)
{
    long positioningMethod=0;
    LocationProvider providerInfo=m_locationManager.getProvider(provider);
    if(providerInfo.requiresSatellite())
    {
        positioningMethod=0x000000ff;//Satellite-based positioning methods such as GPS
    }
    if(providerInfo.requiresCell()||providerInfo.requiresNetwork())
    {
        //0xffffff00 is for other-based positioning methods
        //0xffffffff is for all methods
        positioningMethod|= 0xffffff00;
    }
    return positioningMethod;
}
 
开发者ID:harmattan,项目名称:uds,代码行数:17,代码来源:QtLocation.java

示例15: onStatusChanged

import android.location.LocationProvider; //导入依赖的package包/类
@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 + "'.");
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:17,代码来源:Engine.java


注:本文中的android.location.LocationProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。