How can I send simulated GPS positions to the emulator? (This is not a repeated question because I have tried other solutions, don't work)
1) Opened the Tools->Android->Android Device Monitor The Emulator Control Tab with the Location Controls are un Editable.
2) The emulator also has the "..." option which opens a control panel with Location. There I can see GPS data point and Send, but even if I do nothing changes to my program
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (mMap != null) {
mMap.setMyLocationEnabled(true);
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
3) If I have to use terminal, how do I know which port the emulator is attached.
I have used genymotion and it works well, except can not install google maps there yet.
to answer your third part of your question first: the port your emulator is attached is written on top of your emulator window
There is written the name and afterwards the ports (default would be :5554)
To answer point one and two of your question:
to tell emulator fake gps data via command line you need to connect via telnet:
telnet localhost <your emulator port>
afterwarts it asks you for your auth token. the console will show you path where it is located. You need to enter the token via
auth <your auth token>
now you have a connection to your emulator and tell him whatever you want.
You can find a complete documentation of all commands at https://developer.android.com/studio/run/emulator-commandline.html
... or you type help
into your console ;)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.