Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setElapsedRealtimeNanos #2

Open
ruidalin opened this issue Aug 20, 2016 · 0 comments
Open

setElapsedRealtimeNanos #2

ruidalin opened this issue Aug 20, 2016 · 0 comments

Comments

@ruidalin
Copy link

/**
 * setLocation 设置GPS的位置
 * 
 */
private void setLocation(double longitude, double latitude) {
    Location location = new Location(mMockProviderName);
    location.setTime(System.currentTimeMillis());
    location.setLatitude(latitude);
    location.setLongitude(longitude);
    location.setAltitude(2.0f);
    location.setAccuracy(3.0f);
    if (Build.VERSION.SDK_INT > 16) {
         //api 16以上的需要加上这一句才能模拟定位 , 也就是targetSdkVersion > 16 
        location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
    }
    locationManager.setTestProviderLocation(mMockProviderName, location);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant