MockMockLocations icon indicating copy to clipboard operation
MockMockLocations copied to clipboard

Pokemon Go

Open mtx-z opened this issue 7 years ago • 26 comments

Pokemon Go application on Android seems to detect it anyway (block GPS localization if developer settings is enabled). Would be really cool to have it work with it !

mtx-z avatar Jul 09 '16 11:07 mtx-z

Confirmed :(

NovaCygni avatar Jul 11 '16 07:07 NovaCygni

+1

twilightgod avatar Jul 12 '16 06:07 twilightgod

+1

Rooie89 avatar Jul 12 '16 11:07 Rooie89

+1

veneliniliev avatar Jul 12 '16 17:07 veneliniliev

Ok, it should work now. I released a new update.

bnalls33 avatar Jul 14 '16 06:07 bnalls33

New update seems to help but the game keeps flipping between detecting and not detecting mock locations. Curious if anyone else is having the same problem?

RevMuun avatar Jul 14 '16 14:07 RevMuun

Doesnt work game behaving by itself. It works for making fake gps apps detect on but game detect on too :( i cant see pokeballs or gyms

kayraucklnc avatar Jul 14 '16 15:07 kayraucklnc

What GPS app are you using? What type of phone? I have a Nexus 5X & this GPS app: https://play.google.com/store/apps/details?id=com.incorporateapps.fakegps.fre&hl=en

bnalls33 avatar Jul 14 '16 17:07 bnalls33

It's not the Niantic first localized app. I think there is another check happening. I was able to simulate a path on the game, seeing my player walk on the map following the path/speed i setted. But even if this work, the game see something and say 'cannot locate you'.

mtx-z avatar Jul 14 '16 17:07 mtx-z

Are you moving too quickly along the path?

bnalls33 avatar Jul 14 '16 17:07 bnalls33

Nop, setted a 5km/h speed, the player seems to respect that. So even if i see me moving on the map, the app see something and dont trust/want the locations data.

mtx-z avatar Jul 14 '16 17:07 mtx-z

I have a Galaxy S5 using the same Fake GPS app you're using (PRO version).

Go seems to flip back and forth from accepting my location and failing to locate me. Happy to help debug in any way I can.

RevMuun avatar Jul 14 '16 17:07 RevMuun

2 files in the app are refering to the 'mock' word :

  • FusedLocationProviderApi.java (com\google\android\gsm\location)
    PendingResult<Status> setMockLocation(GoogleApiClient googleApiClient, Location location);
    public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
    public static final String KEY_MOCK_LOCATION = "mockLocation";
  • zzd.java (com\google\android\gsm\location\internal)
    public PendingResult<Status> setMockLocation(GoogleApiClient client, Location mockLocation) {
        return client.zzb(new C06394(this, client, mockLocation));
    }

    public PendingResult<Status> setMockMode(GoogleApiClient client, boolean isMockMode) {
        return client.zzb(new C06383(this, client, isMockMode));
    }

Idk enough of Android/Java to understand something usefull.

I also see near some 'looper' variable, isMockMode boolean, PendingResult result methods... So the localization coming and going, seems to loop. A CRON job like to check Mock Mode somehow.

EDIT: used this to decompile apk

mtx-z avatar Jul 14 '16 22:07 mtx-z

I could successfully mock the location by blocking all apps in MockMock (couldn't whitelist pokemon only). Though my location is jumping between my real and mocked position (maybe since the mocking app don't see the mocking is on).

Did somebody check if they are using a background process to verify if the location is mocked. If they do so, this line sharedPreferences.getStringSet(Common.PREF_KEY_WHITELIST_APP_LIST, new HashSet<String>(0)).contains(lpparam.packageName)) wouldn't work since the package name would be something like com.nianticlabs.pokemongo:background.

skylve avatar Jul 14 '16 22:07 skylve

I haven't checked but you're right, there could be other processes. I didn't build the whitelist for Pokemon Go purposes.

mtx-z Has some good findings too. This is the first I've heard about FusedLocationProvider. KEY_MOCK_LOCATION is new to me. We may need to mock Location.getExtraLocation(KEY_MOCK_LOCATION), and/or modify getExtras() to modify the value "KEY_MOCK_LOCATION" in the bundle.

bnalls33 avatar Jul 14 '16 22:07 bnalls33

Android documentation

KEY_MOCK_LOCATION Key used for the Bundle extra in Location object holding a boolean indicating whether the location was set using setMockLocation(GoogleApiClient, Location).

Also see this stack and this about Fused locator

mtx-z avatar Jul 14 '16 22:07 mtx-z

@bnalls33 The whitelist is a really good feature, downloaded MockMock few days ago and was looking forward this ! Thanks for adding it =) If you want, I can submit a PR to also manage background process.

skylve avatar Jul 14 '16 22:07 skylve

Could you help me out? Im new to this stuff, so please bear with me if i say anything stupid. You said you released a new version that works with pokemon go and other apps, could you provide a link for an apk? Thanks!

ireflex198 avatar Jul 15 '16 03:07 ireflex198

You can find a build here. Note that the app is not 100% working with PokeGo yet.

mtx-z avatar Jul 15 '16 10:07 mtx-z

I tried to view some file using an Hex Editor. From file

\assets\bin\Data\Managed\Metadata

... MockILocationProvider.get_HasValidLocation.get_IsMeasuredLocation.HasValidLocation.IsMeasuredLocation.MockIMapController.add_OnWorldScaleOrOriginChanged.remove_OnWorldScaleOrOriginChanged.get_CompassLock.set_CompassLock.get_Config.set_Config.get_GPSLock.set_GPSLock. ...

mtx-z avatar Jul 15 '16 10:07 mtx-z

Is root required for this BTW? So can i just install the apk and use a gps spoofer? Thanks for the help in advance.

ireflex198 avatar Jul 15 '16 10:07 ireflex198

@ireflex198 take a look at Xposed, this repository is only a module for this framework. Also, this is not really a place to ask for this stuff, more about how to develop it (I saw you created your Github account to ask this question). @bnalls33 we should maybe close this Issue (or rename it?) and create different ones to manage what @mtx-z is saying.

skylve avatar Jul 15 '16 22:07 skylve

@skylve What were you suggesting that your code would do "[I can submit a PR to also] manage background process"

bnalls33 avatar Jul 17 '16 03:07 bnalls33

Was reading up on possible other hooks and saw this: https://stackoverflow.com/questions/6880232/disable-check-for-mock-location-prevent-gps-spoofing

Is it possible that Pokemon Go is looking to see if any app is requesting ACCESS_MOCK_LOCATION permissions and assuming nefarious purposes?

Is there any value to preventing the LocationManager.removeTestProvider function?

RevMuun avatar Jul 20 '16 14:07 RevMuun

How sure are we that it's even pokemon which is doing this? Without pokemon started on my phone (stopped in androids apps settings menu). It also shows the same behaviour in google maps.

Okay so it is indeed because of the FusedLocationService. Check this reddit post how to disable it

https://www.reddit.com/r/PokemonGoSpoofing/comments/4sdqkg/android_if_gps_jumps_from_spoof_location_to_real/

DJWassink avatar Jul 20 '16 15:07 DJWassink

Throwing it out there but most people are just being dumb and havnt set "GPS Mode/Location Services" to "Device Only" and are being dumb using LowPower (* Wifi networks GPS location *) or HighAccuracy... the correct setting should be device GPS only.

NovaCygni avatar Jul 29 '16 07:07 NovaCygni