6

I 'm not able to get the Yandex default Marker's current Latlong values in Android. What I'm really interested is to capture the current latlong values from the android mobile and yandex map marker's position is exactly what I need. Has anyone used yandex maps to get the current user location? Can you please help.

Update 1

While researching on this latlong issue with Google and Yandex, I came across a link for "GPS Fix" app from http://gpsfix.android.informer.com/. After installing this App on the Android device and performing "Start Fixing", the latlong values now provided by Yandex SDK in my custom App is now closer to that of marker's. But still some points show over the buildings beside road (I can adjust that for now). I believe "GPS fix" app does somekind of flushing the GPS cache??? not sure if there is such a thing. I 'm still waiting for a clean solution that works without support from other app.

Thanks, Hemant

Hemant
  • 615
  • 1
  • 8
  • 21
  • Do you want to get a marker's position or the current user's location? – matreshkin Aug 03 '15 at 10:22
  • 1
    I really need the current location but Yandex MapKit doesn't return exact location (it is way off somewhere) where as the marker shows the exact location. So was interested to get the marker's location. – Hemant Aug 03 '15 at 13:56
  • Why don't you want to get the current location from using Android API directly ? – matreshkin Aug 03 '15 at 16:15
  • Yes, I have tried Android API (Play Service) using Fused Location but didn't get accurate location just like Yandex marker. I have adjusted distance change and interval time to 0 but that didn't helped either. – Hemant Aug 04 '15 at 05:05
  • I have added an update (Update 1) on my original question. Thought I should let you know. – Hemant Aug 04 '15 at 12:06
  • You said it is not precise enough? How muсh is the deviation (meters, km?). Could it be a hardware problem (Is this related to a certain device) ? – matreshkin Aug 05 '15 at 06:49
  • The deviation ranges between 30-40 meters. This doesn't seems to be hardware problem coz I tested in 3 android mobile (out of which 2 are Samsung) and all 3 shows the same difference. – Hemant Aug 05 '15 at 07:01

1 Answers1

1

You can try to do smth like this

yandexMap.getMapController().getOverlayManager().getMyLocation().addMyLocationListener(new OnMyLocationListener() {
        @Override
        public void onMyLocationChange(MyLocationItem myLocationItem) {
            GeoPoint geoPoint = myLocationItem.getGeoPoint();
        }
    });

GeoPoint can be converted to Google LatLng

akarimova
  • 200
  • 7
  • Yes, I tried similar code listing from github but still is not giving the accurate location just like the default yandex map marker https://github.com/yandexmobile/yandexmapkit-android/blob/master/yandexmapkit-sample/src/ru/mapkittest/mylocation/MapMyLocationChangeActivity.java) – Hemant Aug 03 '15 at 14:07
  • Hmm.. I am not sure, just my thoughts... 1. Did you add the android.permission.ACCESS_FINE_LOCATION permission? 2. I am not sure that YMaps use Google location.. e.g. it could work pretty well in Russia, but doesn't work smw else... – akarimova Aug 03 '15 at 14:26
  • But Yandex Maps shows exactly where I 'm with my mobile. This is soo close but google's is way off somewhere. So was interested with Yandex map. And yes, we do have ACCESS_FINE_LOCATION permission set in the manifest file. – Hemant Aug 04 '15 at 05:02
  • Yandex.Maps use a different SDK, the public one is too old and almost deprecated. – akarimova Aug 04 '15 at 07:48
  • You mean the Yandex SDK that we are using is different from that of Yandex.Maps SDK? I guess this should not be case coz then it will showcase like yandex shows one and offers a different one but I may be wrong here. – Hemant Aug 04 '15 at 11:51
  • I have added an update (Update 1) on my original question. Thought I should let you know. – Hemant Aug 04 '15 at 12:06