'Is it possible to set arbitrary device location programmatically, per UI test

I was wondering if there is any legitimate way of setting Espresso-based UI test location programmatically (please assume there is no adb access to device, there is no way to enable mock location from device settings). I don't think it's possible but posting the question in case I missed something.

PS.: I am using FusedLocationProvider if that matters.



Solution 1:[1]

Firebase Test Lab supports mocked locations. You'll probably need to install a location provider from your test package, e.g. Android mock location provider sample app is not working

See also How to mock location on device?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Konstantin Svist