4

(Preface: I have already seen this question, but it doesn't address setting the location while debugging the app. Opening "Android Device Monitor" closes the ADB connection to the debugger itself.)

I am trying to debug an application that monitors for location changes. The issue that I have is that I can't figure out how to run the debugger and set the location using adb geo fix ... at the same time.

I have tried running the command in the Android Studio "Debug" -> "Console" tab, but it doesn't seem to do anything.

How can I set the location while still remaining connected in the debugger?

Community
  • 1
  • 1
Moshe Katz
  • 15,992
  • 7
  • 69
  • 116
  • 1
    Have you tried the emulator console (telnet into `localhost:5554`)? – CommonsWare Jan 20 '15 at 18:26
  • @CommonsWare I was afraid that doing that would mess up the connection into Android Studio also, but it does seem to work. It's a shame that there's no built-in way in Android Studio. – Moshe Katz Jan 20 '15 at 18:33

3 Answers3

4

1- go to plugins and look for GPS emulator, and install it then start the emulator from Tools--> Android---> Android device monitor then find you desired location long and lat (search google for any website that gives you the lang lat for your city, google: get lang lat websites) and send them to the android emulator.

2- or fastes way if android emulator is running On the Right Side of Your Android Emulator Where (Power Button ,Speaker , Camera etc Sign are given Find Three Dot Sign(...) at the last of that column. click on that then Click on location and Set the Latitude and longitude

enter image description here

Ridha Rezzag
  • 3,672
  • 1
  • 34
  • 39
2

In the end, I did this using Android GPS Emulator, a Java program which runs on the computer and sends location updates over ADB.

Moshe Katz
  • 15,992
  • 7
  • 69
  • 116
1

You should install application that can set fake gps location like https://play.google.com/store/apps/details?id=com.fakegps.mock run it first, then run your app.

QArea
  • 4,955
  • 1
  • 12
  • 22
  • I can't do that, because I need to have the location change several times *while my app is running* in order to test it properly. – Moshe Katz Jan 20 '15 at 19:31