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


Java GpsStatus类代码示例

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


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

示例1: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
public void onGpsStatusChanged(int event) {

            if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {
                try {
                    // Check number of satellites in list to determine fix state
                    GpsStatus status = myLocationManager.getGpsStatus(null);
                    Iterable<GpsSatellite> satellites = status.getSatellites();

                    sat_count = 0;

                    Iterator<GpsSatellite> satI = satellites.iterator();
                    while (satI.hasNext()) {
                        GpsSatellite satellite = satI.next();
                        Log.d(LogUtils.generateTag(this), "Satellite: snr=" + satellite.getSnr() + ", elevation=" + satellite.getElevation());
                        sat_count++;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    sat_count = min_gps_sat_count + 1;
                }

                Log.d(LogUtils.generateTag(this), "#### sat_count = " + sat_count);

            }
        }
 
开发者ID:richardradics,项目名称:MVPAndroidBootstrap,代码行数:26,代码来源:LocationHelper.java

示例2: b

import android.location.GpsStatus; //导入依赖的package包/类
private void b()
{
    m = 0;
    l = 0;
    GpsStatus gpsstatus = b.getGpsStatus(null);
    if (gpsstatus != null)
    {
        int i1 = gpsstatus.getMaxSatellites();
        Iterator iterator = gpsstatus.getSatellites().iterator();
        if (iterator != null)
        {
            while (iterator.hasNext() && l <= i1) 
            {
                l = 1 + l;
                if (((GpsSatellite)iterator.next()).usedInFix())
                {
                    m = 1 + m;
                }
            }
        }
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:23,代码来源:e.java

示例3: b

import android.location.GpsStatus; //导入依赖的package包/类
private void b() {
    this.m = 0;
    this.l = 0;
    GpsStatus gpsStatus = b.getGpsStatus(null);
    if (gpsStatus != null) {
        int maxSatellites = gpsStatus.getMaxSatellites();
        Iterator it = gpsStatus.getSatellites().iterator();
        if (it != null) {
            while (it.hasNext() && this.l <= maxSatellites) {
                this.l++;
                if (((GpsSatellite) it.next()).usedInFix()) {
                    this.m++;
                }
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:e.java

示例4: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override
public void onGpsStatusChanged(int event) {
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
            if (DEBUG) log("onGpsStatusChanged: GPS_EVENT_STARTED");
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
            if (DEBUG) log("onGpsStatusChanged: GPS_EVENT_STOPPED");
            if (mGpsFixed) {
                mGpsFixed = false;
                notifyGpsFixChanged();
            }
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            if (DEBUG) log("onGpsStatusChanged: GPS_EVENT_FIRST_FIX");
            mGpsFixed = true;
            notifyGpsFixChanged();
            break;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:21,代码来源:GpsStatusMonitor.java

示例5: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override
public void onGpsStatusChanged(int event) {

    switch (event) {
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            gpsEnabled = true;
            gpsFix = true;
            break;
        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            gpsEnabled = true;
            gpsFix = System.currentTimeMillis() - timestamp < DURATION_TO_FIX_LOST_MS;
            break;
        case GpsStatus.GPS_EVENT_STARTED:
            gpsEnabled = true;
            gpsFix = false;
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
            gpsEnabled = false;
            gpsFix = false;
            break;
        default:
            return;
    }
    //Log.d(TAG, "onGpsStatusChanged :: " + event);
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:26,代码来源:GPSDetector.java

示例6: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
public void onGpsStatusChanged(int event) { // GPS状态变化时的回调,如卫星数
            GpsStatus status = locationManager.getGpsStatus(null); //取当前状态
            if(event == GpsStatus.GPS_EVENT_SATELLITE_STATUS){
                int maxSatellites = status.getMaxSatellites();
                Iterator<GpsSatellite> it = status.getSatellites().iterator();
                mSatelliteList.clear();
                int count = 0;
                while (it.hasNext() && count <= maxSatellites) {
                    GpsSatellite s = it.next();
//                Log.i("gjh","~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
//                Log.i("gjh","信号:" + s.getSnr());
//                Log.i("gjh","序号:" + s.getPrn());
//                Log.i("gjh","卫星仰角:" + s.getElevation());
//                Log.i("gjh","卫星方位角 :" + s.getAzimuth());
//                Log.i("gjh","^^^^^^^^^^^^^^^^^^^^^^^^^^^^" );
                    mSatelliteList.add(s);
                    count++;
                }
            }
            mAdapter.notifyDataSetChanged();
            Log.i(TAG,mSatelliteList.size()+"" );
        }
 
开发者ID:Anler2015,项目名称:AndroidPractice,代码行数:23,代码来源:GpsActivity.java

示例7: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override
public void onGpsStatusChanged(int event) {
    String eventStr = null;
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
            eventStr = "GPS_EVENT_STARTED";
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
            eventStr = "GPS_EVENT_STOPPED";
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            eventStr = "GPS_EVENT_FIRST_FIX";
            break;
        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            eventStr = "GPS_EVENT_SATELLITE_STATUS";
            break;
    }
    Log.v(TAG, "onGpsStatusChanged("+ eventStr + ")");

    showGpsStatusInfo(mLocationManager.getGpsStatus(null));
}
 
开发者ID:samuel22gj,项目名称:OtterBenchmark,代码行数:22,代码来源:GpsMonitor.java

示例8: updateGpsStatus

import android.location.GpsStatus; //导入依赖的package包/类
private String updateGpsStatus(int event, GpsStatus status) {  
    StringBuilder sb2 = new StringBuilder("");  
    if (status == null) {  
    	uHandler.sendEmptyMessage(1);
        sb2.append(getResources().getString(R.string.label_gps_satellitenumber) +0);  
    } else if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS) {  
        int maxSatellites = status.getMaxSatellites();  
        Iterator<GpsSatellite> it = status.getSatellites().iterator();  
        numSatelliteList.clear();  
        int count = 0;  
        while (it.hasNext() && count <= maxSatellites) {  
            GpsSatellite s = it.next();  
            numSatelliteList.add(s);  
            count++;  
        }  
        sb2.append(getResources().getString(R.string.label_gps_satellitenumber) + numSatelliteList.size());  
        uHandler.sendEmptyMessage(1);
    }  
      
    return sb2.toString();  
}
 
开发者ID:li-yu,项目名称:iTester,代码行数:22,代码来源:GPSActivity.java

示例9: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
public void onGpsStatusChanged(int event) {

        switch(event)
        {
            case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                m_locationManager.getGpsStatus(m_status);
                Iterable<GpsSatellite> iSatellite=m_status.getSatellites();
                Iterator<GpsSatellite> iterator=iSatellite.iterator();
                ArrayList<QtSatInfo> satInfo=new ArrayList<QtSatInfo>();
                int index=0;
                while(iterator.hasNext())
                {
                    GpsSatellite gpsSat=iterator.next();

                    satInfo.add(new QtSatInfo(gpsSat.getPrn(),gpsSat.getSnr(),
                            gpsSat.getElevation(), gpsSat.getAzimuth()));
                    index++;
                }

                if(0!=index)
                    gpsSatelliteDataUpdated(satInfo.toArray());
                break;
        }

    }
 
开发者ID:harmattan,项目名称:uds,代码行数:26,代码来源:QtLocation.java

示例10: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override public void onGpsStatusChanged(int event) {
	gpsStatus = locationManager.getGpsStatus(gpsStatus);
	switch (event) {
		case GpsStatus.GPS_EVENT_STARTED:
		case GpsStatus.GPS_EVENT_FIRST_FIX:
		case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
		case GpsStatus.GPS_EVENT_STOPPED:
		default:
	}
	int count_seen = 0;
	int count_fix = 0;
	for (GpsSatellite s: gpsStatus.getSatellites()) {
		count_seen++;
		if (s.usedInFix())
			count_fix++;
		// Log.d(TAG, "getSnr=" + s.getSnr());
	}
	// Log.d(TAG, "LocusService.onGpsStatusChanged event=" + event
		// + ", satellites=" + count_fix + "/" + count_seen + "/" + gpsStatus.getMaxSatellites()
		// + ", timeToFirstFix=" + gpsStatus.getTimeToFirstFix()
		// );
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:23,代码来源:LocusService.java

示例11: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override
public void onGpsStatusChanged(int event) {
	switch (event) {
	case GpsStatus.GPS_EVENT_STARTED:
		isGPSFix = false;
		checkGpsStatus();
		break;
	case GpsStatus.GPS_EVENT_FIRST_FIX:
		isGPSFix = true;
		checkGpsStatus();
		break;
	case GpsStatus.GPS_EVENT_STOPPED:
		isGPSFix = false;
		sendStoppedStatus();
		break;
	case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
		isGPSFix = false;
		if ((SystemClock.elapsedRealtime() - mLastLocationMillis) < GPS_UPDATE_EXCEEDED_TIME)
			isGPSFix = true;

		checkGpsStatus();

		break;
	}
}
 
开发者ID:scintero,项目名称:moveon,代码行数:26,代码来源:MoveOnService.java

示例12: getGpsStatus

import android.location.GpsStatus; //导入依赖的package包/类
public GpsStatus getGpsStatus(GpsStatus gpsstatus)
{
    LocationManager locationmanager;
    GpsStatus gpsstatus1;
    GpsStatus gpsstatus2;
    try
    {
        locationmanager = a;
    }
    catch (Throwable throwable)
    {
        throwable.printStackTrace();
        return null;
    }
    gpsstatus1 = null;
    if (locationmanager == null)
    {
        break MISSING_BLOCK_LABEL_26;
    }
    gpsstatus2 = a.getGpsStatus(gpsstatus);
    gpsstatus1 = gpsstatus2;
    return gpsstatus1;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:24,代码来源:LocationManagerProxy.java

示例13: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
public void onGpsStatusChanged(int event) {
    boolean isGPSFix = false;
    switch (event) {
        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            if (lastLocation != null) {
                isGPSFix = (SystemClock.elapsedRealtime() - lastLocationMillis) < 10000;
            }
            if (isGPSFix) { // A fix has been acquired.
                setLocationManagerStatus(AVAILABLE);
            } else { // The fix has been lost.
                setLocationManagerStatus(TEMPORARILY_UNAVAILABLE);
            }
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            setLocationManagerStatus(AVAILABLE);
            break;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:AndroidLocationManager.java

示例14: updateSats

import android.location.GpsStatus; //导入依赖的package包/类
public void updateSats() {
    if ((mlocManager != null) && (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED))
    {
        final GpsStatus gs = mlocManager.getGpsStatus(null);
        int sats_inview = 0;    // Satellites in view;
        int sats_used = 0;      // Satellites used in fix;

        if (gs != null) {
            Iterable<GpsSatellite> sats = gs.getSatellites();
            for (GpsSatellite sat : sats) {
                sats_inview++;
                if (sat.usedInFix()) sats_used++;
                //Log.w("myApp", "[#] GPSApplication.java - updateSats: i=" + i);
            }
            _NumberOfSatellites = sats_inview;
            _NumberOfSatellitesUsedInFix = sats_used;
        } else {
            _NumberOfSatellites = NOT_AVAILABLE;
            _NumberOfSatellitesUsedInFix = NOT_AVAILABLE;
        }
    } else {
        _NumberOfSatellites = NOT_AVAILABLE;
        _NumberOfSatellitesUsedInFix = NOT_AVAILABLE;
    }
    //Log.w("myApp", "[#] GPSApplication.java - updateSats: Total=" + _NumberOfSatellites + " Used=" + _NumberOfSatellitesUsedInFix);
}
 
开发者ID:BasicAirData,项目名称:GPSLogger,代码行数:27,代码来源:GPSApplication.java

示例15: onGpsStatusChanged

import android.location.GpsStatus; //导入依赖的package包/类
@Override
public void onGpsStatusChanged(int event)
{
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
        case GpsStatus.GPS_EVENT_STOPPED:
            mHasGPSFix = false;
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            mHasGPSFix = true;
            break;

        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            mSatellitesCount = 0;

            for (GpsSatellite sat : mLocationManager.getGpsStatus(null).getSatellites()) {
                if (sat.usedInFix()) {
                    mSatellitesCount++;
                }
            }
            break;
    }
}
 
开发者ID:nextgis,项目名称:android_maplibui,代码行数:24,代码来源:TrackerService.java


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