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


Java GpsStatus.GPS_EVENT_STARTED属性代码示例

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


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

示例1: onGpsStatusChanged

@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,代码行数:20,代码来源:GpsStatusMonitor.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

@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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: onGpsStatusChanged

@Override
public void onGpsStatusChanged(int arg0) {
    switch (arg0) {
    case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
        GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
        int usedinfix = 0;

        if (gpsStatus != null) {
            Iterator<GpsSatellite> satellites = gpsStatus
                    .getSatellites().iterator();

            if (satellites != null) {
                while (satellites.hasNext()) {
                    GpsSatellite satellite = satellites.next();

                    if (satellite.usedInFix()) {
                        usedinfix++;
                    }
                }
            }
        }
        mUsedInFix = usedinfix;
        if (mUsedInFix < 3) {
            updateGpsSpeed(-1);
        }
        break;

    case GpsStatus.GPS_EVENT_STARTED:
        break;
    case GpsStatus.GPS_EVENT_STOPPED:
        break;
    }
}
 
开发者ID:rockcarry,项目名称:CameraDVR,代码行数:33,代码来源:LocationMonitor.java

示例11: onGpsStatusChanged

@Override
public void onGpsStatusChanged(final int event) {
	int satCount = -1;

	switch (event) {
		case GpsStatus.GPS_EVENT_FIRST_FIX:
			satCount = 0;
			break;
		case GpsStatus.GPS_EVENT_STARTED:
			satCount = -1;
			break;
		case GpsStatus.GPS_EVENT_STOPPED:
			satCount = -1;
			break;
		case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
			// first of all we check if the time from the last used fix to the current fix is greater than the logging interval
			if ((event != GpsStatus.GPS_EVENT_SATELLITE_STATUS)
					|| (mLastGPSTimestamp + gpsLoggingInterval) < System.currentTimeMillis()) {
				mLastGPSTimestamp = System.currentTimeMillis(); // save the time of this fix

				final GpsStatus status = lmgr.getGpsStatus(null);

				// Count active satellites
				satCount = 0;
				for (@SuppressWarnings("unused") final GpsSatellite sat:status.getSatellites()) {
					satCount++;
				}
			}
			break;
		default:
			break;
	}

	if (mListener != null) {
		mListener.onSatInfo(satCount);
	}

}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:38,代码来源:GpsProvider.java

示例12: onGpsStatusChanged

@Override public void onGpsStatusChanged(int event) {
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
            Log.d(TAG, "GPS has started.");
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
            Log.d(TAG, "GPS has stopped.");
            checkLocationEnabled();
            if (mBackgroundLocationService.getGoogleApiClient().isConnected() && !mLocationEnabled) {
                Log.d(TAG, "Disconnecting location client");
                Toast.makeText(this, "Location disabled.", Toast.LENGTH_SHORT).show();
            }
            break;
    }
}
 
开发者ID:shiftconnects,项目名称:android-location-service,代码行数:15,代码来源:MainActivity.java

示例13: onGpsStatusChanged

public void onGpsStatusChanged(int event) {
    //GpsStatus gpsStatus = locationManager.getGpsStatus(null);
    switch (event) {
        case GpsStatus.GPS_EVENT_STARTED:
            //displayGPSNotification();
            break;
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            try {
                showToast(getResources().getString(R.string.gps_fix_success_msg), Toast.LENGTH_LONG, Gravity.CENTER);
                int satellitesInFix = 0;
                for (GpsSatellite sat : locationManager.getGpsStatus(null).getSatellites()) {
                    if (sat.usedInFix()) {
                        satellitesInFix++;
                    }
                }
                if (actionMode != null) {
                    int accuracy = (int) locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getAccuracy();
                    actionMode.setTitle(accuracy + getResources().getString(R.string.gps_accuracy));
                    actionMode.setSubtitle(satellitesInFix + " " + getResources().getString(R.string.sats_use_msg));
                }
            } catch (Exception e) {
                e.printStackTrace();
                cf.appLog("", e);
            }
            break;
        case GpsStatus.GPS_EVENT_STOPPED:
            //showToast("GPS_EVENT_STOPPED", Toast.LENGTH_SHORT, 0);
            break;
    }
}
 
开发者ID:MASTUSAID,项目名称:MAST-MOBILE,代码行数:30,代码来源:CaptureDataMapActivity.java

示例14: onGpsStatusChanged

public void onGpsStatusChanged(int event) {
    switch (event) {
        //第一次定位
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            Log.i(TAG, "第一次定位");
            break;
        //卫星状态改变
        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            //获取当前状态
            GpsStatus gpsStatus = lm.getGpsStatus(null);
            //获取卫星颗数的默认最大值
            int maxSatellites = gpsStatus.getMaxSatellites();
            //创建一个迭代器保存所有卫星
            Iterator<GpsSatellite> iters = gpsStatus.getSatellites().iterator();
            int count = 0;
            while (iters.hasNext() && count <= maxSatellites) {
                GpsSatellite s = iters.next();
                count++;
            }
            break;
        //定位启动
        case GpsStatus.GPS_EVENT_STARTED:
            Log.i(TAG, "定位启动");
            break;
        //定位结束
        case GpsStatus.GPS_EVENT_STOPPED:
            Log.i(TAG, "定位结束");
            break;
    }
}
 
开发者ID:OMNILab,项目名称:ArubaSyslog,代码行数:30,代码来源:GPS_Server.java

示例15: onGpsStatusChanged

public void onGpsStatusChanged(int event) {
    switch (event) {
        // 第一次定位
        case GpsStatus.GPS_EVENT_FIRST_FIX:
            break;
        // 卫星状态改变
        case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
            // 获取当前状态
            GpsStatus gpsStatus = locationManager.getGpsStatus(null);
            // 获取卫星颗数的默认最大值
            int maxSatellites = gpsStatus.getMaxSatellites();
            // 创建一个迭代器保存所有卫星
            Iterator<GpsSatellite> iters = gpsStatus.getSatellites().iterator();
            int count = 0;
            while (iters.hasNext() && count <= maxSatellites) {
                GpsSatellite s = iters.next();
                if (s.usedInFix())
                    count++;
            }
            break;
        // 定位启动
        case GpsStatus.GPS_EVENT_STARTED:
            break;
        // 定位结束
        case GpsStatus.GPS_EVENT_STOPPED:
            break;
    }
}
 
开发者ID:qbeenslee,项目名称:Nepenthes-Android,代码行数:28,代码来源:GPSHelper.java


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