當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。