Android simulation Location program, commonly known as GPS spoofing, can only modify the use of GPS positioning software. There are 4 types of mobile positioning methods: Base station location, WiFi location, GPS positioning, AGPS positioning
Common methods of modification:1. Grab the packet spoofing, grab the packet to deceive the server side, but have to specifically targeted an app, and now many app packets are encrypted 2. Hook Java layer latitude and longitude get function, this method used to be used, now not 3. Hook native layer latitude and longitude get function 4. Use allow impersonation of Address location information (not very generic with version restrictions)
In order to modify the location of Friends Circle information, for fun tried some of the above methods 1. Xpose Hook Java layer GPS function tried it without using 2. Packet capture found all encrypted (last year latitude information is not encrypted) 3. Hook native did not go to study 4. Allow address location information simulation (measured can be used) without root but with version restrictions, this feature is limited after 5.0
4.4.2 version of Nexus failed red Rice 4.1.2 succeeded
The following is the main explanation of Method 4, allowing simulation of geo-location information method
I. Turn on allow location information simulationThis feature is available in the developer options, which allows you to check the location information
two. Start Coding
1. Member Definitions private String mmockprovidername = locationmanager. Gps_provider; private thread thread; private locationmanager locationmanager; private Boolean is_run = true;
2. Initialize /*** inilocation Initialization position Simulation * */private void init_location() { Locationmanager = (locationmanager) this. Getsystemservice (Context. location_service); Locationmanager. Addtestprovider (mmockprovidername, false, true, false, false, true , True, true, 0, 5); Locationmanager. settestproviderenabled (mmockprovidername, true); Locationmanager. requestlocationupdates (mmockprovidername, 0, 0, this);}
3. Set up geo-location simulation @SuppressLint("Newapi") private void setlocation(double longitude, double Latitude) { Location location = new location (mmockprovidername); Location . settime (System. Currenttimemillis ());Location . Setlatitude (latitude);Location . Setlongitude (longitude);Location . Setaltitude (2.0f);Location . setaccuracy (3.0f);Location . Setelapsedrealtimenanos (systemclock. Elapsedrealtimenanos ()); Locationmanager. settestproviderlocation (mmockprovidername, location);}
4. Open thread has been modified //Open thread, always modify GPS coordinatesthread = new thread(new Runnable() { @Override Public void run() {While (is_run) { try { Thread. Sleep (a); setlocation(longitude, latitude);} Catch (interruptedexception e) { e. Printstacktrace (); } } }});thread. Start();
5. Detect if the Allow address location simulation is turned on import android.provider.Settings; if (Settings. Secure. getInt (getcontentresolver(),Settings. Secure. allow_mock_location, 0)! = 0) { //Open Geo simulation }
Finally, add the Baidu Map SDK can be arbitrary to obtain latitude and longitude coordinates and modify the geographical coordinates of Baidu Map SDK usage: http://www.cnblogs.com/bingghost/p/5816023.html
code upload github:Https://github.com/bingghost/Traversing
The final effect:
From for notes (Wiz)
Android Analog location information