warren-bank / Android-Mock-Location

Android app that mocks the GPS and Network location providers.
GNU General Public License v2.0
102 stars 21 forks source link

also behave as a UnifiedNlp provider #13

Open khimaros opened 1 year ago

khimaros commented 1 year ago

it would be great if this also behaved as a UnifiedNlp provider, as GMS/FCM apps will often use this instead of direct network or GPS access. this causes location to jump around unless all Nlp providers are disabled.

warren-bank commented 1 year ago

Hi. Interesting request. I'll be the first to admit that I needed to do a little Googling and reading.. to get a basic understanding of what this would mean.

Unrelated to Google Location Service vs. UnifiedNlp.. both of which derive location data from sources that cannot be mocked.. and would otherwise interfere with location mocking.. and, hence, should be disabled when attempting to mock location (ie: by choosing either "device only" sources, or possibly also "high accuracy" sources).. I did notice that the LocationManager API has 2x other location providers that neither this app (nor FakeTraveler) currently mock.. and I would assume we could (and should):

I'll need to play around with this a little.. and see if it's a good idea (or not).

warren-bank commented 1 year ago

notes (to self):

warren-bank commented 1 year ago

correction.. regarding the UnifiedNlp issue (mentioned above).. I think I read it too quickly and got its feature request a bit backwards.. the request was for the UnifiedNlp to be used as the source for mock location data on non-rooted devices.. rather than the other way around.. so, idk.. ?? TBD.. I need to do some more reading..

warren-bank commented 1 year ago

notes (to self):

khimaros commented 1 year ago

wow, thank you for the thorough reply!

I was indeed referring to using mock locations as a source (provider) for UnifiedNlp requests.

as far as I know there is no technical limitation on using mock data for in a UnifiedNlp provider.

warren-bank commented 1 year ago

I have LineageOS on a few devices that I occasionally use to test app compatability with various versions of Android, but I've never played around with microG or UnifiedNlp.. so you'll be able to answer this better than me:

warren-bank commented 1 year ago

when in doubt.. read the code!

interestingly.. this could work:

specifically.. albeit a bit hacky:

warren-bank commented 1 year ago

The release for v2.2.0 adds a 2nd app, which is a backend provider plugin for UnifiedNlp. This plugin requires that Mock my GPS be installed and started, otherwise it doesn't do anything.

Strictly speaking, on a system that has UnifiedNlp working.. Mock my GPS doesn't need to be set as the default app to mock location data in Developer Options; so long as it's running, it will pass its mock location data to UnifiedNlp.

I've only confirmed with the debugger that binding to all of the services is working correctly. However, I don't have UnifiedNlp installed as a system app.. so I'm only about 95% sure that it will work. It would be great if you could test it for me.. and report back with any observations.. good or bad.

khimaros commented 1 year ago

awesome work! I will test and let you know!