模拟固定卫星的数量

时间:2021-02-23 18:25:18

标签: android mock-location

嗨 我需要在 Android 上模拟固定卫星的位置、速度和数量。我使用的是旧应用程序 (mock-geofix),它运行良好,但我无法设置固定卫星的数量。

    protected void _simulate(double longitude, double latitude, double altitude, int satellites) {
    Location mockLocation = new Location(locationProviderName); // a string
    mockLocation.setLatitude(latitude);  // double
    mockLocation.setLongitude(longitude);
    mockLocation.setAltitude(altitude);
    Random rd = new Random(); // creating Random object
    mockLocation.setSpeed(rd.nextFloat());

        Bundle bundle = new Bundle();
        bundle.putInt("satellites", satellites);
        mockLocation.setExtras(bundle);

    mockLocation.setTime(System.currentTimeMillis());
    mockLocation.setAccuracy(accuracy);
    _simulate(mockLocation);
}

我传递了所有变量(经度、纬度、高度、卫星)它工作正常我可以模拟位置(随机速度也有效)但固定卫星的数量永远是 0!

谢谢..

0 个答案:

没有答案