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

locationChanged never runs #21

Closed
ethanzh opened this issue Aug 13, 2018 · 7 comments
Closed

locationChanged never runs #21

ethanzh opened this issue Aug 13, 2018 · 7 comments

Comments

@ethanzh
Copy link

ethanzh commented Aug 13, 2018

Hello.

I have added mad-location-manager to my Gradle build as well as Android manifest and have implemented LocationServiceInterface within my application. Inside my Fragment's onCreate method I run the following code:

ServicesHelper.getLocationService(getActivity(), value -> {

            if (value.IsRunning()){
                return;
            }
            value.stop();
            KalmanLocationService.Settings settings =
                    new KalmanLocationService.Settings(Utils.ACCELEROMETER_DEFAULT_DEVIATION,
                            Utils.GPS_MIN_DISTANCE,
                            Utils.GPS_MIN_TIME,
                            Utils.GEOHASH_DEFAULT_PREC,
                            Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
                            Utils.SENSOR_DEFAULT_FREQ_HZ,
                            null, false);

            value.reset(settings);
            value.start();

            Log.d("MAD", Boolean.toString(value.IsRunning()));
        });

This returns "False" in my LogCat, indicating that even though I 'start' the service it never actually stops running. I have overridden locationChanged() in my Fragment as well to simply log the new latitudes and longitudes but no matter how much walking around I do with the phone this function never runs.

What could be preventing my KalmanLocationService from starting?

@ethanzh
Copy link
Author

ethanzh commented Aug 13, 2018

I have just done some more testing and found something interesting.

When running the tutorial application hosted on this repo with a Samsung Galaxy S5 I am able to get location updates (however I cannot see these on the map, maybe this is because I am in USA and not Russia?). When I run this same test on a different device (https://www.motorola.com/us/products/moto-e-gen-4) it does not work.

Does this have to do with the sensors that are available on the phone?

@Lezh1k
Copy link
Collaborator

Lezh1k commented Aug 13, 2018

Hello, @ethanzh

Seem's like everything is fine with motorola. Due to specification accelerometer and magnetometer sensors are presented. I don't think that is's related to gyro.

Could you check that GPS is enabled in phone settings? I saw this behavior when my location source was "network", not "gps".

@ethanzh
Copy link
Author

ethanzh commented Aug 14, 2018

The phone indeed says "gps" and not network.

I think this brings up my broader question: what is the best way to implement your mad-location-manager in an app that already has a different location manager already implemented (in my case, FusedLocationProvider)?

@Lezh1k
Copy link
Collaborator

Lezh1k commented Aug 17, 2018

Thant's really stange :)
Can you collect and send some logs?
I can't really help without more details about your project. Do you have some repo or something like that? I'll try to help with that

@ethanzh
Copy link
Author

ethanzh commented Aug 17, 2018

I'm happy to share my code I just have one question first: will mad location manager be more accurate/consistent than FusedLocationManager?

@Lezh1k
Copy link
Collaborator

Lezh1k commented Aug 18, 2018

Honestly it needs to be checked.
We don't use FusedLocationManager because of issues with play market on some old phones. :)

@dgaenko
Copy link

dgaenko commented Aug 20, 2018

Спасибо за Ваш труд! Очень интересный проект, но, честно говоря, я так и не понял метода интеграции в свое приложение. Можно совсем коротенький пример для пустого проекта - только интеграция сервиса и получение откорректированных координат (без MVP, плиз).
Заранее премного благодарен.

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

3 participants