Skip to content

docs(motion): add orientation listener example to README#2558

Open
OS-ruimoreiramendes wants to merge 4 commits into
mainfrom
docs/motion-orientation
Open

docs(motion): add orientation listener example to README#2558
OS-ruimoreiramendes wants to merge 4 commits into
mainfrom
docs/motion-orientation

Conversation

@OS-ruimoreiramendes

@OS-ruimoreiramendes OS-ruimoreiramendes commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

README

Description

Add an 'orientation' listener example to the Motion plugin README alongside the existing 'accel' one.

Closes #2539.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Notes / Comments

Plan to backport to 7.x.

@OS-ruimoreiramendes OS-ruimoreiramendes changed the title docs(motion): add orientation listener example to docs(motion): add orientation listener example to README Jun 29, 2026
@OS-ruimoreiramendes OS-ruimoreiramendes marked this pull request as ready for review June 29, 2026 14:06

@jcesarmobile jcesarmobile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can this be separate examples?
users might want to listen for the events separately, should look more to what we do in the example app
https://github.com/ionic-team/capacitor-testapp/blob/main/src/pages/Motion.tsx

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Released dev build of motion with dev version: 8.0.1-dev-2558-20260702T163136.0

@OS-ruimoreiramendes

Copy link
Copy Markdown
Contributor Author

can this be separate examples? users might want to listen for the events separately, should look more to what we do in the example app https://github.com/ionic-team/capacitor-testapp/blob/main/src/pages/Motion.tsx

@jcesarmobile I've split the doc into two separate examples. Take another look when you can.

@jcesarmobile

jcesarmobile commented Jul 2, 2026

Copy link
Copy Markdown
Member

The text says "most browsers require permission check", but that's not true, the permissions are iOS only, the current examples result in the code not working on Android/Web, it should check if the requestPermission method is available before trying to call it, check MDN examples.

BTW, Capacitor 7 is out of support, so there is no need to cherry-pick anymore.
But there are unreleased changes on 7.x branch, so if you do, we can do a final release and release those changes too.

@OS-ruimoreiramendes

Copy link
Copy Markdown
Contributor Author

BTW, Capacitor 7 is out of support, so there is no need to cherry-pick anymore.
But there are unreleased changes on 7.x branch, so if you do, we can do a final release and release those changes too.

@jcesarmobile Updated the intro to make the permission check iOS-only, and guarded both requestPermission() calls with typeof ... === 'function' following the MDN pattern. Also added the !== 'granted' check so we don't try to subscribe when the user denies.

Regarding the 7.x backport, I'll go ahead and cherry-pick this once merged so we can bundle it with the other pending 7.x changes for the final release.

Comment thread motion/README.md Outdated
permission on any user-initiated action (such as a button click):
This plugin is currently implemented using Web APIs. On iOS, permission must
be requested before accessing device motion or orientation events. Other
platforms do not require the check. To request permission, prompt the user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's iOS devices, including web platform when testing on iOS devices, not just iOS platform, so "Other platforms" is not correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Take another look please

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.

Orientation document of capacitor/motion is wrong.

3 participants