Android – Set GPS location in Android Studio while debugging app

adbandroidandroid-studiodebugginglocation

(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?

Best Solution

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