當前位置: 首頁>>代碼示例>>Java>>正文


Java GpsStatus.GPS_EVENT_SATELLITE_STATUS屬性代碼示例

本文整理匯總了Java中android.location.GpsStatus.GPS_EVENT_SATELLITE_STATUS屬性的典型用法代碼示例。如果您正苦於以下問題:Java GpsStatus.GPS_EVENT_SATELLITE_STATUS屬性的具體用法?Java GpsStatus.GPS_EVENT_SATELLITE_STATUS怎麽用?Java GpsStatus.GPS_EVENT_SATELLITE_STATUS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.location.GpsStatus的用法示例。


在下文中一共展示了GpsStatus.GPS_EVENT_SATELLITE_STATUS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onGpsStatusChanged

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,代碼行數:25,代碼來源:LocationHelper.java

示例2: onGpsStatusChanged

@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,代碼行數:25,代碼來源:GPSDetector.java

示例3: onGpsStatusChanged

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,代碼行數:22,代碼來源:GpsActivity.java

示例4: onGpsStatusChanged

@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,代碼行數:21,代碼來源:GpsMonitor.java

示例5: updateGpsStatus

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,代碼行數:21,代碼來源:GPSActivity.java

示例6: onGpsStatusChanged

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,代碼行數:25,代碼來源:QtLocation.java

示例7: onGpsStatusChanged

@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,代碼行數:22,代碼來源:LocusService.java

示例8: onGpsStatusChanged

@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,代碼行數:25,代碼來源:MoveOnService.java

示例9: onGpsStatusChanged

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,代碼行數:18,代碼來源:AndroidLocationManager.java

示例10: onGpsStatusChanged

@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,代碼行數:23,代碼來源:TrackerService.java

示例11: onGpsStatusChanged

@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:
            break;
    }

    for (GpsEventListener listener : mListeners) {
        listener.onGpsStatusChanged(event);
    }
}
 
開發者ID:nextgis,項目名稱:android_maplib,代碼行數:20,代碼來源:GpsEventSource.java

示例12: onGpsStatusChanged

@Override
public void onGpsStatusChanged(int arg0) {
	// TODO Auto-generated method stub
	GpsStatus gpsstatus = locationManager.getGpsStatus(null);    
   	 switch (arg0) {
        case GpsStatus.GPS_EVENT_STARTED:
           mSkyView.setStarted();
           setStarted(true);   
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
           mSkyView.setStopped();
           setStarted(false);   
            break;

        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:        	 
            mSkyView.setSats(gpsstatus);
            updateStatus(gpsstatus);
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:           	        
           break;
    }
}
 
開發者ID:takyonxxx,項目名稱:Flight-Computer-Android-Flightradar24,代碼行數:22,代碼來源:GpsSkyActivity.java

示例13: checkFix

/**
 * Checks if there fix is still there based on the last picked location.
 * 
 * @param hasFix fix state previous to the check. 
 * @param lastLocationUpdateMillis the millis of the last picked location.
 * @param event the Gps status event triggered.
 * @return <code>true</code>, if it has fix.
 */
public static boolean checkFix( boolean hasFix, long lastLocationUpdateMillis, int event ) {
    switch( event ) {
    case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
        long diff = SystemClock.elapsedRealtime() - lastLocationUpdateMillis;
        if (GPLog.LOG_ABSURD)
            GPLog.addLogEntry("GPSSTATUSINFO", "gps event diff: " + diff);
        if (diff < FIX_TIME_INTERVAL_CHECK) {
            if (!hasFix) {
                hasFix = true;
            }
        } else {
            if (hasFix) {
                hasFix = false;
            }
        }
        break;
    }
    return hasFix;
}
 
開發者ID:GitHubDroid,項目名稱:geodroid_master_update,代碼行數:27,代碼來源:GpsStatusInfo.java

示例14: onGpsStatusChanged

public void onGpsStatusChanged(int event) {
	switch (event) {
	case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
		if (mLocationListener.getLastGpsLocation() != null) {
			if ((System.currentTimeMillis() - mLocationListener.getLastGpsLocation().getTime()) < MAX_TIME_GPS_FIX) {
				if (!mGpsFix)
					mGpsFix = true;
			} else {
				if (mGpsFix) {
					enable();
				}
				mGpsFix = false;
			}
		}
		break;
	case GpsStatus.GPS_EVENT_FIRST_FIX:
		mGpsFix = true;
		break;
	case GpsStatus.GPS_EVENT_STARTED:
		break;
	case GpsStatus.GPS_EVENT_STOPPED:
		mGpsFix = false;
		break;
	}
}
 
開發者ID:BeyondAR,項目名稱:beyondar,代碼行數:25,代碼來源:BeyondarLocationManager.java

示例15: onGpsStatusChanged

public synchronized void onGpsStatusChanged(int event)
{
    if (event == GpsStatus.GPS_EVENT_SATELLITE_STATUS)
    {
        if (mLastGPSMillis != 0)
        {
            isGPSFix = (SystemClock.elapsedRealtime() - mLastGPSMillis) < 
                     getMinTime() * 2;
        }
    }
    else if (event == GpsStatus.GPS_EVENT_FIRST_FIX)
    {
        isGPSFix = true;
    }
    
    ProviderType previousType = currentProvider;
    currentProvider = isGPSFix ? ProviderType.GPS : ProviderType.BOTH;
    
    if(previousType != currentProvider)
    {
        switchProvider();
    }
}
 
開發者ID:Jules-,項目名稱:terraingis,代碼行數:23,代碼來源:LocationWorker.java


注:本文中的android.location.GpsStatus.GPS_EVENT_SATELLITE_STATUS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。