question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set altitude by setlocation

See original GitHub issue

The problem

Cannot set altitude by setlocation

Environment

  • Appium version (or git revision) that exhibits the issue: 1.14.0-beta.2
  • Last Appium version that did not exhibit the issue (if applicable): N/A
  • Desktop OS/version used to run Appium: macOS 10.14.5
  • Node.js version (unless using Appium.app|exe): v12.4.0
  • Npm or Yarn package manager: npm
  • Mobile platform/version under test: Android 9
  • Real device or emulator/simulator: Real device
  • Appium CLI or Appium.app|exe: CLI

Details

Just called below codes from python-client, but altitude isn’t updated to args.

SampleAndroidTest.py

def test_01_test_name(self):
    self.driver.set_location(121.21, 11.56, 10)
    import time
    time.sleep(10)
    print(self.driver.location)

Terminal

➜  app_apidemo git:(master) ✗ python SampleAndroidTest.py
test_01_test_name (__main__.SimpleTest) ... {'latitude': 121.21, 'longitude': 11.56, 'altitude': 5e-324}
ok

----------------------------------------------------------------------
Ran 1 test in 25.996s

OK

I can set altitude by executing below adb commands.

➜  app_apidemo git:(master) ✗ adb -P 5037 -s 13f1fd2c shell am startservice -e longitude 11.56 -e latitude 121.21 -e altitude 0 io.appium.settings/.LocationService 
Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=io.appium.settings/.LocationService (has extras) }
➜  app_apidemo git:(master) ✗ adb -P 5037 -s 13f1fd2c shell am broadcast -n io.appium.settings/.receivers.LocationInfoReceiver -a io.appium.settings.location      
Broadcasting: Intent { act=io.appium.settings.location flg=0x400000 cmp=io.appium.settings/.receivers.LocationInfoReceiver }
Broadcast completed: result=-1, data="121.21000 11.56000 0.00000"

➜  app_apidemo git:(master) ✗ adb -P 5037 -s 13f1fd2c shell am startservice -e longitude 11.56 -e latitude 121.21 -e altitude 10 io.appium.settings/.LocationService
Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=io.appium.settings/.LocationService (has extras) }
➜  app_apidemo git:(master) ✗ adb -P 5037 -s 13f1fd2c shell am broadcast -n io.appium.settings/.receivers.LocationInfoReceiver -a io.appium.settings.location       
Broadcasting: Intent { act=io.appium.settings.location flg=0x400000 cmp=io.appium.settings/.receivers.LocationInfoReceiver }
Broadcast completed: result=-1, data="121.21000 11.56000 10.00000"

Link to Appium logs

https://gist.github.com/ki4070ma/729244eb37734209fbcbe0d1bae5e9fc

https://gist.github.com/ki4070ma/729244eb37734209fbcbe0d1bae5e9fc#file-appium_logs-L185-186

Although passing 10 as altitude to the server, but 10 isn’t used during executing adb.

[debug] [W3C (d1034c44)] Calling AppiumDriver.setGeoLocation() with args: [{"latitude":121.21,"longitude":11.56,"altitude":10},"d1034c44-82e4-43cf-a63a-fd0aaa9f8e04"]
[debug] [ADB] Running '/Users/atsushimori/Library/Android/sdk/platform-tools/adb -P 5037 -s 13f1fd2c shell am startservice -e longitude 11.56 -e latitude 121.21 io.appium.settings/.LocationService'

Code To Reproduce Issue [ Good To Have ]

As above.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, Jul 13, 2019

We can still mention it only works on real devices

1reaction
mykola-mokhnachcommented, Jul 11, 2019

yes, this documentation has to be fixed. Altitude support has never been there

Read more comments on GitHub >

github_iconTop Results From Across the Web

JComponent setSize() and setLocation() not working
Rectangle r = new Rectangle(x, y, length, length); will always put the rectangle at x, y. I tried using setLocation, using a different...
Read more >
How to set location, altitude, airspeed, heading - X-Plane.org
Using XP 11, I cannot (1) position the aircraft except on an airport, (2) set altitude, (3) set airspeed and (4) set heading....
Read more >
Set Altitude when jumping to latitude/longitude C# ...
How to set altitude when I jump to a latitude / longitude C# SIMCONNECT ? I use this to jump to the location...
Read more >
javax.swing.JFrame.setLocation java code examples - Tabnine
frame.pack(); frame.setLocation(location, Toolkit.getDefaultToolkit().getScreenSize().height - 400);
Read more >
Cannot set location parameters at startup - APT Forum
Cannot set to elevation. Cannot set UTC time. I am using a Celestron AVX mount and it has been aligned. APT is connected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found