Skip to content

feat: add support for heading#14

Merged
ItsChaceD merged 9 commits intoionic-team:mainfrom
27pchrisl:heading
Mar 4, 2026
Merged

feat: add support for heading#14
ItsChaceD merged 9 commits intoionic-team:mainfrom
27pchrisl:heading

Conversation

@27pchrisl
Copy link
Copy Markdown
Contributor

Hi!

I was using @capacitor/geolocation and found that for iOS it uses the "course" from CLLocation instead of the "heading" from CLHeading. This means you only get the direction of movement, and not the compass bearing.

Because that library uses this library, I've added the support to this library to add these values first.

This change will make the location regenerate every time the compass moves more than 1 degree (as fast as I can tell that's how the iOS Compass app updates as well).

@ItsChaceD ItsChaceD changed the title Heading support feat: add support for heading Feb 5, 2026
@ItsChaceD ItsChaceD requested a review from a team February 5, 2026 16:19
@OS-pedrogustavobilro OS-pedrogustavobilro self-assigned this Feb 6, 2026
Copy link
Copy Markdown
Contributor

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ItsChaceD left some comments for you to take a look, when you can.

@27pchrisl thank you for the PR! We'll be doing a review and also making any necessary changes. I believe there's no action here on your end, but feel free to reply to any comments or ask questions if you have any. Thanks again!

@OS-pedrogustavobilro
Copy link
Copy Markdown
Contributor

@ItsChaceD I think some unit tests are failing, if you could take a look please.

@OS-pedrogustavobilro
Copy link
Copy Markdown
Contributor

@ItsChaceD don't know if this was happening with you, but when testing, I'm getting a spam of location updates, that I don't think I every got before. Maybe it's locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) that gets called very often? Maybe we should minimize the heading updates a bit, perhaps using interval parameter, or similarly to Android only send headings when there's a new location?

@OS-pedrogustavobilro
Copy link
Copy Markdown
Contributor

@27pchrisl the PR ended up having some changes, feel free to share your thoughts if any of these go against your use case.

Particularly

This change will make the location regenerate every time the compass moves more than 1 degree (as fast as I can tell that's how the iOS Compass app updates as well).

Now the location is not regenerated every time there is a new heading, but rather we locally update the heading in the library and return it only where there's a new location. Related comment: #14 (comment)

@ItsChaceD ItsChaceD merged commit a1d9bb7 into ionic-team:main Mar 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants