Like In native android they can check the captured Location is Fake ,Mock or not. Same in xamrian essential Geolocation API as we are capturing Lat and Long from this , Should have this feature.
@jamesmontemagno we can add this property in Location class:
public bool IsReal { get; set; }
In LocationExtensions.ToLocation()
To android we can set:
IsReal = !location.IsFromMockProvider
To iOS we can set:
IsReal = (location.VerticalAccuracy == 10) && (location.Altitude == 0.000000)
based in this answer
To UWP it's more complicated because the PositionSource enum, see docs:
but i think this way that good:
IsReal = (location.Coordinate.PositionSource == PositionSource.Unknown) || (location.Coordinate.PositionSource == PositionSource.Obfuscated)
If this looks good for you I send the PR.
It should just be:
public bool IsFromMockProvider {get;set;}
iOS returns if it is on a simulator or not... easy enough
UWP would always be false
Android this code: https://github.com/jamesmontemagno/GeolocatorPlugin/blob/c18a061b712cad82f14c980e13301a199c3f8012/src/Geolocator.Plugin/Android/GeolocationUtils.android.cs#L77-L80
Hi James
Thanks for your response.
Earlier I was using your plugin to get geolocation in xamarin forms.
But after xamarin essential, I removed all your plugin as xamarin essential also developed by you and have more features.
So what u r talking about to again include geolocator plugin to check this ?
Right now as I was not getting anything, I have written dependency service to check all app permission with mock location in android.
I tried to get the captured location from shared code to dependency service for Android IsFromMockProvider property after jellybean but failed.
So can you more elaborate on this with some example.
Thanks
@jangra1981 James and I were talking about including this feature in Xamarin.Essentials. If you check my PR, you will see your suggestion implemented ;) .
@pictos, @james
Ok ok...I have seen...You are discussing how you can implement or include this feature in xamarin essential in future release..
I am desperately waiting for it. Any timeline
Thanks
Yup, just checking the code. @jangra1981 I assume this only matters on Android for you?
@james as I am developing xamarin forms app which is already on play store and app store, if it can happen for all platform everyone would be happy and for future also.
Otherwise mainly require right now for Android and iOS.
For fake location feature one of the client point it out to me. As in my app user current location is must and should be accurate and one of the user pushed fake lat long on server by using mock location setting of android and fake gps app
Thank you
I wish there was a feature of GitHub where we can fork and publish PRs right away to *NuGet. This way, it could already generate a lot of feedback from us devs. I am waiting for this feature as well as the Multi-Gallery select, which unfortunately is not available in public release yet.
Hi @jamesmontemagno
When we can get this feature in Xamarin Essential.
Thank you
It is in the 1.1.0 milestone
@mr5z we are working on something like this :)