Skip to content

Instantly share code, notes, and snippets.

@Areizen
Last active December 22, 2023 11:57
Show Gist options
  • Save Areizen/76d98ca75d8286e324407591047f2406 to your computer and use it in GitHub Desktop.
Save Areizen/76d98ca75d8286e324407591047f2406 to your computer and use it in GitHub Desktop.
const simulated_latitude = 48.8534
const simulated_longitude = 2.3488
Java.perform(function(){
const Location = Java.use('android.location.Location')
var location = Location.$new("gps")
location.setLatitude(simulated_latitude)
location.setLongitude(simulated_longitude)
Location.$init.overload("android.location.Location").implementation = function(x){
console.log("Instantiated new location ( Location ) ")
return location
}
Location.$init.overload("java.lang.String").implementation = function(x){
console.log("Instantiated new location ( String ) ")
return location
}
Location.getLatitude.implementation = function(){
console.log("Old latitude : " + this.getLatitude() + ", New Latitude : " + simulated_latitude)
return simulated_latitude
}
Location.getLongitude.implementation = function(){
console.log("Old longitude : " + this.getLongitude() + ", New Longitude : " + simulated_longitude)
return simulated_longitude
}
// Not sure if needed, bypass fake location check
Location.isFromMockProvider.implementation = function(){
console.log("Location.isFromMockProvider -> false")
return false
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment