Advertisement
Guest User

Android Mock GPS Location Guide

a guest
Jan 3rd, 2024
1,434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | Software | 0 0
  1. # Android Mock GPS Location Guide
  2. Tested in Jan 2024 using Ubuntu 23.10 and a Samsung Galaxy S5 SM-G900I (kltedv). You can likely substitute the phone for another model, or substitue the PC OS for an adware platform that plays games.
  3.  
  4. ### Requirements
  5. 1. PC with `adb` and `fastboot` installed.
  6. 2. A spare [LineageOS supported handset](https://wiki.lineageos.org/devices/).
  7. 3. A USB data cable to connect the two.
  8.  
  9. ### Install LineageOS + Gapps
  10. 1. Go to [download.lineageos.org](https://download.lineageos.org) and download the latest .zip, boot.img and recovery.img for your device.
  11. 2. Go to [mindthegapps.com](https://mindthegapps.com/download/) and download the appropriate gapps package for your device and LineageOS version.
  12.  
  13. 3. Connect the USB cable and boot the phone into fastboot mode. Flash the recovery image:
  14.  
  15. ```
  16. $ fastboot flash recovery recovery.img
  17. Sending 'recovery' (12948 KB) OKAY [ 0.558s]
  18. Writing 'recovery' OKAY [ 0.284s]
  19. Finished. Total time: 0.843s
  20. ```
  21.  
  22. 4. Reboot to recovery mode
  23.  
  24. 5. Run `Factory Reset` -> `Format system partition`
  25.  
  26. 6. Select `Apply Update` -> `Apply from ADB`. Sideload the LineageOS zip file. Ignore any errors in the terminal. The phone screen will tell you if it worked.
  27.  
  28. ```
  29. $ adb sideload lineage-18.1-20231222-nightly-kltedv-signed.zip
  30. serving: 'lineage-18.1-20231222-nightly-kltedv-signed.zip' (~47%) adb: failed to read command: Success
  31. ```
  32.  
  33. 7. Hit `Apply from ADB` again and do the GApps package. Ignore any signature verification errors.
  34.  
  35. ```
  36. $ adb sideload MindTheGapps-11.0.0-arm-20230922_081034.zip
  37. serving: 'MindTheGapps-11.0.0-arm-20230922_081034.zip' (~47%) adb: failed to read command: Success
  38. ```
  39. 8. Run `Factory Reset` -> `Format data/factory reset`. Note: This erases absolutely all of your data on the phone. I assume your handset contains nothing important.
  40.  
  41. 8. Reboot the phone. It will boot into LineageOS. Run through the basic setup ensuring that "Use Location" is selected on the Google Services page.
  42.  
  43.  
  44. ### Enable ADB
  45. 1. Go to `Settings` -> `About phone` and tap `Build number` 7 times to enable developer options.
  46.  
  47. 2. Go to `Settings` -> `System` -> `Developer options` and enable `USB debugging`. Allow your computer to connect.
  48.  
  49.  
  50. ### Install Magisk
  51.  
  52. 1. Download:
  53. * [Magisk](https://github.com/topjohnwu/Magisk/releases)
  54. * [LSposed](https://github.com/LSPosed/LSPosed/releases) module
  55. * [Shamiko](https://github.com/LSPosed/LSPosed.github.io/releases) module.
  56. * [SafetyNet Fix](https://github.com/kdrag0n/safetynet-fix/releases) module.
  57.  
  58. 2. Install Magisk over adb:
  59. ```
  60. $ adb install Magisk-v26.4.apk
  61. Performing Streamed Install
  62. Success
  63. ```
  64.  
  65. 3. Copy the LineageOS `boot.img` file to your handset:
  66. ```
  67. $ adb push boot.img /sdcard/
  68. boot.img: 1 file pushed, 0 skipped. 41.3 MB/s (8142864 bytes in 0.188s)
  69. ```
  70.  
  71. 3. Open Magisk App
  72. * Select `Install` for Magisk.
  73. * Select `Select and Patch a File`
  74. * Select the `boot.img` file from the phone's internal storage
  75. * Click `Let's Go`
  76.  
  77. This will produce a new boot image. The file location will appear on the handset. Copy the file to your PC. Note that the filename is different every time.
  78.  
  79. ```
  80. $ adb pull /storage/emulated/0/Download/magisk_patched-26400_XXXXX.img
  81. /storage/emulated/0/Download/magisk_patched-26400_XXXXX.img: 1 file pulled, 0 skipped. 20.3 MB/s (8386560 bytes in 0.394s)
  82. ```
  83.  
  84. 4. Reboot to recovery
  85. ```
  86. adb reboot recovery
  87. ```
  88.  
  89. 5. Select `Advanced` -> `Enter fastboot`
  90.  
  91. * Flash the patched boot image:
  92. ```
  93. $ fastboot flash boot magisk_patched-26400_XXXXX.img
  94. Sending 'boot' (8190 KB) OKAY [ 0.330s]
  95. Writing 'boot' OKAY [ 0.183s]
  96. Finished. Total time: 0.527s
  97. ```
  98.  
  99. 6. Reboot the phone, open the Magisk app and run the additional setup when prompted. The phone will reboot again.
  100.  
  101. ### Install Magisk Modules
  102. 1. Copy the downloaded modules to the handset
  103. ```
  104. $ adb push LSPosed-v1.9.2-7024-zygisk-release.zip /sdcard/
  105. LSPosed-v1.9.2-7024-zygisk-release.zip: 1 file pushed, 0 skipped. 107.2 MB/s (2462055 bytes in 0.022s)
  106. $ adb push Shamiko-v0.7.5-194-release.zip /sdcard/
  107. Shamiko-v0.7.5-194-release.zip: 1 file pushed, 0 skipped. 26.3 MB/s (258167 bytes in 0.009s)
  108. $ adb push safetynet-fix-v2.4.0.zip /sdcard/
  109. safetynet-fix-v2.4.0.zip: 1 file pushed, 0 skipped. 10.0 MB/s (96532 bytes in 0.009s)
  110. ```
  111.  
  112. 2. Open the Magisk app.
  113.  
  114. 3. Under `Settings`, enable `Zygisk`. Don't reboot yet.
  115.  
  116. 4. Select `Modules` -> `Install from Storage`.
  117.  
  118. 5. Install the LSposed zip file. Don't reboot yet.
  119.  
  120. 6. Install the Shamiko zip file. Don't reboot yet.
  121.  
  122. 7. Install the SafetyNet Fix zip file. Reboot the handset.
  123.  
  124. 8. Open the Magisk app and go to `Settings` -> `Hide the Magisk app`. Set an appropriate name for the new package and apply it.
  125.  
  126. ### Install GPS Joystick
  127.  
  128. 1. Install "Fake GPS Location - GPS Joystick" (`com.theappninjas.fakegpsjoystick`) from the [Google Play Store](https://play.google.com/store/apps/details?id=com.theappninjas.fakegpsjoystick). Alternatively, you can download the apk from their [website](http://www.gpsjoystick.theappninjas.com/).
  129.  
  130. 2. Go to `Settings` -> `System` -> `Developer options` -> `Select mock location app` and set it to `GPS Joystick`.
  131.  
  132. ### Install Hide Mock Location
  133.  
  134. 1. Download the latest [Hide Mock Location](https://github.com/ThePieMonster/HideMockLocation/releases/) apk.
  135.  
  136. 2. Install the apk:
  137. ```
  138. $ adb install HideMockLocation-2.0.9.apk
  139. Performing Streamed Install
  140. Success
  141. ```
  142.  
  143. 3. There will be a notification from LSPosed in the notification drawer. Tap it to open LSPosed.
  144.  
  145. 4. Go to `Modules` and select `Hide Mock Location`. Enable the module and select `System Framework`.
  146.  
  147. ### Install Your App
  148.  
  149. 1. From the Google Play Store, install the app that wish to hide your location from. Popular examples include the "Japanese anime monster catching app" and "Australian convenience store fuel voucher app".
  150.  
  151. 2. Open the Magisk app and go to `Settings` -> `Configure Denylist`. Expand the selection for your app and enable every item. Leave the "Enforce Denylist" option disabled.
  152.  
  153. 3. Open the LSPosed app. Go to `Modules` and select `Hide Mock Location`. Enable the module and select the newly installed app.
  154.  
  155. 4. Reboot.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement