How to set location at the run-time(While executing Appium Script in pcloudy devices)? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to set location at the run-time(While ...

How to set location at the run-time(While executing Appium Script in pcloudy devices)?


Code Snippet

Object deviceId = driver.executeScript("pCloudy_executeAdbCommand", "adb devices");
Object mockLocation = driver.executeScript("pCloudy_executeAdbCommand", "adb -s "+deviceId+" shell appops set com.pcloudy.services android:mock_location allow"); 
double latitude = 28.585895;
double longitude = 77.313255;
Object setLocation = driver.executeScript("pCloudy_executeAdbCommand", "adb -s "+deviceId+" shell am startservice --user 0 -n com.pcloudy.services/.rockr --ei op 0 --es lat "+latitude+" --es lon "+longitude);

Leave a Reply

Your email address will not be published. Required fields are marked *