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

How to change latitude and longitude at the same time? #10

Closed
imtypist opened this issue Apr 24, 2018 · 7 comments
Closed

How to change latitude and longitude at the same time? #10

imtypist opened this issue Apr 24, 2018 · 7 comments

Comments

@imtypist
Copy link

I want to know about that is there any way to change latitude, longitude, bearing, etc. at the same time by using java api.

GenymotionManager genymotion = GenymotionManager.getGenymotionManager(MainActivity.this);
        genymotion.getGps()
                .setBearing(bearing)
                .setAccuracy(1.0f)
                .setAltitude(altitude)
                .setLatitude(latitude)
                .setLongitude(longitude);

The usage in the gpsTest example only changes them in order, not at the same time.

@fbarthelery
Copy link

I'm not sure of the behavior you want. Your sample code looks right to me.

The current methods allow to change latitude, longitude, etc with a fluent API. You have to call multiple methods on the GPS object but there should be only one GPS update.

@imtypist
Copy link
Author

imtypist commented Apr 24, 2018

But the fluent API will update these parameters one by one, i.e, I noticed that the bearing is updated first, and accuracy is updated following, etc. It would trigger onLocationChanged 5 times, which looks like I change coordinates twice on a map (latitude and longitude are updated independently).

So I want to find a method to update these params at the same time.
Thank you for replying.

@fbarthelery
Copy link

But the fluent API will update these parameters one by one, i.e, I noticed that the bearing is updated first, and accuracy is updated following, etc. It would trigger onLocationChanged 5 times, which looks like I change coordinates twice on a map (latitude and longitude are updated independently).

Right. That's a bug, we are working on it and it should be fixed in the next release of Genymotion.
The API is not going to change so your actual code should just work :)

@imtypist
Copy link
Author

That's good, thanks a lot!
Would you update the java api implement, i.e, update the java api version? The latest version is 1.0.4
And may I ask you that when the next release would come out?

@pcansGny
Copy link
Contributor

Hi! yeah we made these calls blocking, to ease the use of the API.
Each call blocks until the update is seen from your application context.

It can be painfully slow when 5 or 6 calls are chained.

We will add a new multi-parameters method in the next version of the API, it will speed things up, and avoid staircase effects.

@imtypist
Copy link
Author

Get it!
Thank you very much.:smile:

@agateau-g
Copy link
Contributor

Just to let you know, today we released version 1.1.0 of Genymotion Java API, which comes with a new API for the Gps to let you set all parameters of a location in one call. You can use it like this:

LocationParams params = new LocationParams.Builder()
         .setAltitude(12)
         .setLongitude(34)
         .build();
gps.setLocation(params);

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

4 participants