Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

DeviceOrientation & DeviceMotion events

Last updated on : 2023-03-20

Note:
DeviceOrientation & DeviceMotion events shows a browser compatibility score of 88. This is a collective score out of 100 to represent browser support of a web technology. The higher this score is, the greater is the browser compatibility. The browser compatibility score is not a 100% reflection for every browser and the web technology support. However, it does give you an estimate on how much you should rely on a particular web technology in terms of browser compatibility.

Overview

The DeviceOrientation Event is an abstract that represents native motion events fired by a device, such as acceleration and rotation rate.

Code snippets

DeviceOrientation.html

Source:DeviceOrientation.html Github

copy

Full Screen

1<!DOCTYPE html>2<html class="no-js" lang="zh-cn">3  <head>4    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':5      new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],6      j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=7      '///gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);8      })(window,document,'script','dataLayer','GTM-5V25JL6');9    </script>10    <link href="https:///css?family=Roboto&amp;display=swap" rel="stylesheet" />11    <meta charset="utf-8" />12    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />13    <meta name="viewport" content="width=device-width, initial-scale=1.0" />14    <meta name="twitter:card" content="summary" />15    <meta property="og:title" content="DeviceOrientation - Unity 脚本 API" />16    <title>DeviceOrientation - Unity 脚本 API</title>17    <meta name="description" content="描述由操作系统确定的设备的物理方向。" />18    <meta property="og:description" content="描述由操作系统确定的设备的物理方向。" />19    <meta name="author" content="Unity Technologies" />20    <link rel="shortcut icon" href="https://unity.com/themes/contrib/unity_base/images/favicons/favicon.ico" />21    <link rel="icon" type="image/png" href="../StaticFiles/images/favicons/favicon.png" />22    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../StaticFiles/images/favicons/apple-touch-icon-152x152.png" />23    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../StaticFiles/images/favicons/apple-touch-icon-144x144.png" />24    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="../StaticFiles/images/favicons/apple-touch-icon-120x120.png" />25    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../StaticFiles/images/favicons/apple-touch-icon-114x114.png" />26    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../StaticFiles/images/favicons/apple-touch-icon-72x72.png" />27    <link rel="apple-touch-icon-precomposed" href="../StaticFiles/images/favicons/apple-touch-icon.png" />28    <meta name="msapplication-TileColor" content="#222c37" />29    <meta name="msapplication-TileImage" content="../StaticFiles/images/favicons/tileicon-144x144.png" />30    <script type="text/javascript" src="https://" charset="UTF-8" data-domain-script="6e91be4c-3145-4ea2-aa64-89d716064836">31    </script>32    <script type="text/javascript">33        function OptanonWrapper() { }34    </script>35    <script>36      var docs_type = 'ScriptReference';37      var lang = 'cn';38      var page = 'DeviceOrientation';39      if(!page) page = 'index';40      var version = '2021.3';41      var docs_versions = [{version: '2022.1',version_string: '2022.1',supported: true},{version: '2021.3',version_string: '2021.3',supported: true},{version: '2021.2',version_string: '2021.2',supported: false},{version: '2021.1',version_string: '2021.1',supported: false},{version: '2020.3',version_string: '2020.3',supported: true},{version: '2020.2',version_string: '2020.2',supported: false},{version: '2020.1',version_string: '2020.1',supported: false},{version: '2019.4',version_string: '2019.4',supported: true},{version: '2019.3',version_string: '2019.3',supported: false},{version: '2019.2',version_string: '2019.2',supported: false},{version: '2019.1',version_string: '2019.1',supported: false},{version: '2018.4',version_string: '2018.4',supported: false},{version: '2018.3',version_string: '2018.3',supported: false},{version: '2018.2',version_string: '2018.2',supported: false},{version: '2018.1',version_string: '2018.1',supported: false},{version: '2017.4',version_string: '2017.4',supported: false},{version: '2017.3',version_string: '2017.3',supported: false},{version: '2017.2',version_string: '2017.2',supported: false},{version: '2017.1',version_string: '2017.1',supported: false},{version: '5.6',version_string: '560',supported: false},];</script>42    <script type="text/javascript" src="../StaticFiles/js/jquery.js">43    </script>44    <script type="text/javascript" src="../StaticFiles/js/core.js">45    </script>46    <script type="text/javascript" src="../StaticFiles/js/jquery.sidebar.min.js">47    </script>48    <script type="text/javascript" src="docdata/toc.js">49    </script>50    <script type="text/javascript" src="">51    </script>52    <script type="text/javascript" src="../StaticFiles/js/custom.js">53    </script>54    <link rel="stylesheet" type="text/css" href="../StaticFiles/css/core.css" />55    <link rel="stylesheet" type="text/css" href="../StaticFiles/css/custom.css" />56    <link rel="canonical" href="https://docs.unity3d.com/cn/2021.3/ScriptReference/DeviceOrientation.html" />57    <link rel="alternate" href="https://docs.unity3d.com/en/2021.3/ScriptReference/DeviceOrientation.html" hreflang="en" />58    <link rel="alternate" href="https://docs.unity3d.com/cn/2021.3/ScriptReference/DeviceOrientation.html" hreflang="zh" />59    <link rel="alternate" href="https://docs.unity3d.com/ja/2021.3/ScriptReference/DeviceOrientation.html" hreflang="ja" />60    <link rel="alternate" href="https://docs.unity3d.com/es/2021.3/ScriptReference/DeviceOrientation.html" hreflang="es" />61    <link rel="alternate" href="https://docs.unity3d.com/kr/2021.3/ScriptReference/DeviceOrientation.html" hreflang="ko" />62    <link rel="alternate" href="https://docs.unity3d.com/ru/2021.3/ScriptReference/DeviceOrientation.html" hreflang="ru" />63    <link rel="alternate" href="https://docs.unity3d.com/2021.3/Documentation/ScriptReference/DeviceOrientation.html" hreflang="x-default" />64  </head>65  <body>66    <noscript>67      <iframe src="///ns.html?id=GTM-5V25JL6" height="0" width="0" style="display:none;visibility:hidden">68      </iframe>69    </noscript>70    <div class="header-wrapper">71      <div id="header" class="header">72        <div class="content">73          <div class="spacer">74            <div class="menu">75              <div id="nav-open" for="nav-input">76                <span>77                </span>78              </div>79              <div class="logo">80                <a href="./index.html">81                </a>82              </div>83              <div class="search-form">84                <form action="30_search.html" method="get" class="apisearch">85                  <input type="text" name="q" placeholder="搜索脚本..." autosave="Unity Reference" results="5" class="sbox field" id="q">86                  </input>87                  <input type="submit" class="submit">88                  </input>89                </form>90              </div>91              <ul class="menu-items">92                <li class="menu-item">93                  <a href="../Manual/index.html" class="">手册</a>94                </li>95                <li class="menu-item">96                  <a href="../ScriptReference/index.html" class="selected">脚本 API</a>97                </li>98              </ul>99            </div>100          </div>101          <div class="more">102            <div class="filler">103            </div>104            <ul>105              <li>106                <a href="https://unity3d.com/">107                unity3d.com108              </a>109              </li>110            </ul>111          </div>112        </div>113      </div>114      <div class="toolbar">115        <div class="content">116          <div class="version-switcher">117            <div class="current toggle" data-target=".version-list">118              <div class="version-number">119                <div class="d-inline-block">120          Version:121          <b>2021.3</b></div>122                <div class="d-inline-block arrow">123                </div>124              </div>125            </div>126            <div class="version-list" style="display:none;">127              <ul class="versions">128                <li class="supported">129                  <a class="docs_version_url_2022.1" href="/cn/2022.1/ScriptReference/DeviceOrientation.html">2022.1</a>130                </li>131                <li class="supported">132                  <a class="docs_version_url_2021.3" href="/cn/2021.3/ScriptReference/DeviceOrientation.html">2021.3</a>133                </li>134                <li class="">135                  <a class="docs_version_url_2021.2" href="/cn/2021.2/ScriptReference/DeviceOrientation.html">2021.2</a>136                </li>137                <li class="">138                  <a class="docs_version_url_2021.1" href="/cn/2021.1/ScriptReference/DeviceOrientation.html">2021.1</a>139                </li>140                <li class="supported">141                  <a class="docs_version_url_2020.3" href="/cn/2020.3/ScriptReference/DeviceOrientation.html">2020.3</a>142                </li>143                <li class="">144                  <a class="docs_version_url_2020.2" href="/cn/2020.2/ScriptReference/DeviceOrientation.html">2020.2</a>145                </li>146                <li class="">147                  <a class="docs_version_url_2020.1" href="/cn/2020.1/ScriptReference/DeviceOrientation.html">2020.1</a>148                </li>149                <li class="supported">150                  <a class="docs_version_url_2019.4" href="/cn/2019.4/ScriptReference/DeviceOrientation.html">2019.4</a>151                </li>152                <li class="">153                  <a class="docs_version_url_2019.3" href="/cn/2019.3/ScriptReference/DeviceOrientation.html">2019.3</a>154                </li>155                <li class="">156                  <a class="docs_version_url_2019.2" href="/cn/2019.2/ScriptReference/DeviceOrientation.html">2019.2</a>157                </li>158                <li class="">159                  <a class="docs_version_url_2019.1" href="/cn/2019.1/ScriptReference/DeviceOrientation.html">2019.1</a>160                </li>161                <li class="">162                  <a class="docs_version_url_2018.4" href="/cn/2018.4/ScriptReference/DeviceOrientation.html">2018.4</a>163                </li>164                <li class="">165                  <a class="docs_version_url_2018.3" href="/cn/2018.3/ScriptReference/DeviceOrientation.html">2018.3</a>166                </li>167                <li class="">168                  <a class="docs_version_url_2018.2" href="/cn/2018.2/ScriptReference/DeviceOrientation.html">2018.2</a>169                </li>170                <li class="">171                  <a class="docs_version_url_2018.1" href="/cn/2018.1/ScriptReference/DeviceOrientation.html">2018.1</a>172                </li>173                <li class="">174                  <a class="docs_version_url_2017.4" href="/cn/2017.4/ScriptReference/DeviceOrientation.html">2017.4</a>175                </li>176                <li class="">177                  <a class="docs_version_url_2017.3" href="/cn/2017.3/ScriptReference/DeviceOrientation.html">2017.3</a>178                </li>179                <li class="">180                  <a class="docs_version_url_2017.2" href="/cn/2017.2/ScriptReference/DeviceOrientation.html">2017.2</a>181                </li>182                <li class="">183                  <a class="docs_version_url_2017.1" href="/cn/2017.1/ScriptReference/DeviceOrientation.html">2017.1</a>184                </li>185                <li class="">186                  <a class="docs_version_url_560" href="/cn/560/ScriptReference/DeviceOrientation.html">5.6</a>187                </li>188                <div class="versionsWithThisPage" style="display:none;">189                  <li>190                    <p>包含此页的版本:</p>191                  </li>192                </div>193                <div class="versionsWithoutThisPage" style="display:none;">194                  <li>195                    <p>不含此页的版本:</p>196                  </li>197                </div>198              </ul>199              <ul class="description">200                <li>201                  <div class="supported-box">202                  </div>受支持</li>203                <li>204                  <div class="legacy-box">205                  </div>旧版</li>206              </ul>207            </div>208          </div>209          <ul class="nav-menu-items">210            <li class="menu-item">211              <a href="../Manual/index.html" class="">手册</a>212            </li>213            <li class="menu-item">214              <a href="../ScriptReference/index.html" class="selected">脚本 API</a>215            </li>216          </ul>217          <div class="lang-switcher">218            <div class="current toggle" data-target=".lang-list">219              <div class="lbl">语言:220        <span class="b">中文</span></div>221              <div class="arrow">222              </div>223            </div>224            <div class="lang-list" style="display:none;">225              <ul>226                <li>227                  <a data-lang="en" href="/2021.3/Documentation/ScriptReference/DeviceOrientation.html">English</a>228                </li>229                <li>230                  <a data-lang="cn" href="/cn/2021.3/ScriptReference/DeviceOrientation.html">中文</a>231                </li>232                <li>233                  <a data-lang="ja" href="/ja/2021.3/ScriptReference/DeviceOrientation.html">日本語</a>234                </li>235                <li>236                  <a data-lang="es" href="/es/2021.3/ScriptReference/DeviceOrientation.html">Español</a>237                </li>238                <li>239                  <a data-lang="kr" href="/kr/2021.3/ScriptReference/DeviceOrientation.html">한국어</a>240                </li>241                <li>242                  <a data-lang="ru" href="/ru/2021.3/ScriptReference/DeviceOrientation.html">Русский</a>243                </li>244              </ul>245            </div>246          </div>247        </div>248      </div>249    </div>250    <div id="master-wrapper" class="master-wrapper clear">251      <div id="sidebar" class="sidebar hidden">252        <div class="sidebar-wrap">253          <div class="content">254            <div class="sidebar-menu">255              <div class="toc">256                <h2>脚本 API</h2>257                <div class="version-switcher">258                  <div class="current toggle" data-target=".version-list">259                    <div class="version-number">260                      <div class="d-inline-block">261          Version:262          <b>2021.3</b></div>263                      <div class="d-inline-block arrow">264                      </div>265                    </div>266                  </div>267                  <div class="version-list" style="display:none;">268                    <ul class="versions">269                      <li class="supported">270                        <a class="docs_version_url_2022.1" href="/cn/2022.1/ScriptReference/DeviceOrientation.html">2022.1</a>271                      </li>272                      <li class="supported">273                        <a class="docs_version_url_2021.3" href="/cn/2021.3/ScriptReference/DeviceOrientation.html">2021.3</a>274                      </li>275                      <li class="">276                        <a class="docs_version_url_2021.2" href="/cn/2021.2/ScriptReference/DeviceOrientation.html">2021.2</a>277                      </li>278                      <li class="">279                        <a class="docs_version_url_2021.1" href="/cn/2021.1/ScriptReference/DeviceOrientation.html">2021.1</a>280                      </li>281                      <li class="supported">282                        <a class="docs_version_url_2020.3" href="/cn/2020.3/ScriptReference/DeviceOrientation.html">2020.3</a>283                      </li>284                      <li class="">285                        <a class="docs_version_url_2020.2" href="/cn/2020.2/ScriptReference/DeviceOrientation.html">2020.2</a>286                      </li>287                      <li class="">288                        <a class="docs_version_url_2020.1" href="/cn/2020.1/ScriptReference/DeviceOrientation.html">2020.1</a>289                      </li>290                      <li class="supported">291                        <a class="docs_version_url_2019.4" href="/cn/2019.4/ScriptReference/DeviceOrientation.html">2019.4</a>292                      </li>293                      <li class="">294                        <a class="docs_version_url_2019.3" href="/cn/2019.3/ScriptReference/DeviceOrientation.html">2019.3</a>295                      </li>296                      <li class="">297                        <a class="docs_version_url_2019.2" href="/cn/2019.2/ScriptReference/DeviceOrientation.html">2019.2</a>298                      </li>299                      <li class="">300                        <a class="docs_version_url_2019.1" href="/cn/2019.1/ScriptReference/DeviceOrientation.html">2019.1</a>301                      </li>302                      <li class="">303                        <a class="docs_version_url_2018.4" href="/cn/2018.4/ScriptReference/DeviceOrientation.html">2018.4</a>304                      </li>305                      <li class="">306                        <a class="docs_version_url_2018.3" href="/cn/2018.3/ScriptReference/DeviceOrientation.html">2018.3</a>307                      </li>308                      <li class="">309                        <a class="docs_version_url_2018.2" href="/cn/2018.2/ScriptReference/DeviceOrientation.html">2018.2</a>310                      </li>311                      <li class="">312                        <a class="docs_version_url_2018.1" href="/cn/2018.1/ScriptReference/DeviceOrientation.html">2018.1</a>313                      </li>314                      <li class="">315                        <a class="docs_version_url_2017.4" href="/cn/2017.4/ScriptReference/DeviceOrientation.html">2017.4</a>316                      </li>317                      <li class="">318                        <a class="docs_version_url_2017.3" href="/cn/2017.3/ScriptReference/DeviceOrientation.html">2017.3</a>319                      </li>320                      <li class="">321                        <a class="docs_version_url_2017.2" href="/cn/2017.2/ScriptReference/DeviceOrientation.html">2017.2</a>322                      </li>323                      <li class="">324                        <a class="docs_version_url_2017.1" href="/cn/2017.1/ScriptReference/DeviceOrientation.html">2017.1</a>325                      </li>326                      <li class="">327                        <a class="docs_version_url_560" href="/cn/560/ScriptReference/DeviceOrientation.html">5.6</a>328                      </li>329                      <div class="versionsWithThisPage" style="display:none;">330                        <li>331                          <p>包含此页的版本:</p>332                        </li>333                      </div>334                      <div class="versionsWithoutThisPage" style="display:none;">335                        <li>336                          <p>不含此页的版本:</p>337                        </li>338                      </div>339                    </ul>340                    <ul class="description">341                      <li>342                        <div class="supported-box">343                        </div>受支持</li>344                      <li>345                        <div class="legacy-box">346                        </div>旧版</li>347                    </ul>348                  </div>349                </div>350                <div class="clear">351                </div>352              </div>353            </div>354          </div>355        </div>356      </div>357      <div id="content-wrap" class="content-wrap opened-sidebar">358        <div class="content-block">359          <div class="content">360            <div class="section">361              <div class="mb20 clear" id="">362                <h1 class="heading inherit">DeviceOrientation</h1>363                <div class="clear">364                </div>365                <p class="cl mb0 left mr10">enumeration</p>366                <div class="clear">367                </div>368                <a href="" class="switch-link gray-btn sbtn left hide">切换到手册</a>369                <div class="clear">370                </div>371              </div>372              <div class="subsection">373                <div class="signature">374                  <div class="signature-CS sig-block">375                    <span style="color:red;">376                    </span>377                  </div>378                </div>379              </div>380              <div class="subsection">381                <h2>描述</h2>382                <p>描述由操作系统确定的设备的物理方向。</p>383              </div>384              <div class="subsection">385                <p>386        如果设备在物理上位于离散位置之间,如在387(例如)对角旋转时,则系统将报告 Unknown 方向。388      </p>389              </div>390              <div class="subsection">391                <h2>变量</h2>392                <table class="list">393      <tr><td class="lbl"><a href="DeviceOrientation.Unknown.html">Unknown</a></td><td class="desc">无法确定该设备的方向。</td></tr>394      <tr><td class="lbl"><a href="DeviceOrientation.Portrait.html">Portrait</a></td><td class="desc">设备处于纵向模式,直立握持设备,主屏幕按钮位于底部。</td></tr>395      <tr><td class="lbl"><a href="DeviceOrientation.PortraitUpsideDown.html">PortraitUpsideDown</a></td><td class="desc">设备处于纵向模式,但是上下颠倒,直立握持设备,主屏幕按钮位于顶部。</td></tr>396      <tr><td class="lbl"><a href="DeviceOrientation.LandscapeLeft.html">LandscapeLeft</a></td><td class="desc">设备处于横向模式,直立握持设备,主屏幕按钮位于右侧。</td></tr>397      <tr><td class="lbl"><a href="DeviceOrientation.LandscapeRight.html">LandscapeRight</a></td><td class="desc">设备处于横向模式,直立握持设备,主屏幕按钮位于左侧。</td></tr>398      <tr><td class="lbl"><a href="DeviceOrientation.FaceUp.html">FaceUp</a></td><td class="desc">该设备与地面保持平行,屏幕朝上。</td></tr>399      <tr><td class="lbl"><a href="DeviceOrientation.FaceDown.html">FaceDown</a></td><td class="desc">该设备与地面保持平行,屏幕朝下。</td></tr>400    </table>401              </div>402            </div>403            <div class="footer-wrapper">404              <div class="footer clear">405                <div class="copy">Copyright © 2022 Unity Technologies. Publication 2021.3</div>406                <div class="menu">407                  <a href="https://learn.unity.com/">教程</a>408                  <a href="https://answers.unity3d.com">社区答案</a>409                  <a href="https://support.unity3d.com/hc/en-us">知识库</a>410                  <a href="https://forum.unity3d.com">论坛</a>411                  <a href="https://unity3d.com/asset-store">Asset Store</a>412                </div>413              </div>414              <div>415              </div>416            </div>417          </div>418        </div>419      </div>420    </div>421  </body>...

Full Screen

a771844f9214e374.html

Source:a771844f9214e374.html Github

copy

Full Screen

1<!DOCTYPE html>2<html><head><title>DeviceOrientation</title><link rel="stylesheet" href="../../styles.css"/><script src="../../scripts.js"></script></head><body onload="ro();">3<div class="rH">33 references to DeviceOrientation</div><div class="rA">Xamarin.Forms.Core (12)</div><div class="rG" id="Xamarin.Forms.Core"><div class="rF"><div class="rN">DeviceInfo.cs (2)</div>4<a href="../DeviceInfo.cs.html#10"><b>10</b>		<i>DeviceOrientation</i> _currentOrientation;</a>5<a href="../DeviceInfo.cs.html#13"><b>13</b>		public <i>DeviceOrientation</i> CurrentOrientation</a>6</div>7<div class="rF"><div class="rN">DeviceOrientationExtensions.cs (8)</div>8<a href="../DeviceOrientationExtensions.cs.html#8"><b>8</b>		public static bool IsLandscape(this <i>DeviceOrientation</i> orientation)</a>9<a href="../DeviceOrientationExtensions.cs.html#10"><b>10</b>			return orientation == <i>DeviceOrientation</i>.Landscape || orientation == <i>DeviceOrientation</i>.LandscapeLeft || orientation == <i>DeviceOrientation</i>.LandscapeRight;</a>10<a href="../DeviceOrientationExtensions.cs.html#13"><b>13</b>		public static bool IsPortrait(this <i>DeviceOrientation</i> orientation)</a>11<a href="../DeviceOrientationExtensions.cs.html#15"><b>15</b>			return orientation == <i>DeviceOrientation</i>.Portrait || orientation == <i>DeviceOrientation</i>.PortraitDown || orientation == <i>DeviceOrientation</i>.PortraitUp;</a>12</div>13<div class="rF"><div class="rN">MasterDetailPage.cs (2)</div>14<a href="../MasterDetailPage.cs.html#133"><b>133</b>				<i>DeviceOrientation</i> orientation = Device.Info.CurrentOrientation;</a>15<a href="../MasterDetailPage.cs.html#149"><b>149</b>			<i>DeviceOrientation</i> orientation = Device.Info.CurrentOrientation;</a>16</div>17</div>18<div class="rA">Xamarin.Forms.Core.UnitTests (3)</div><div class="rG" id="Xamarin.Forms.Core.UnitTests"><div class="rF"><div class="rN">MasterDetailFormUnitTests.cs (3)</div>19<a href="../../Xamarin.Forms.Core.UnitTests/MasterDetailFormUnitTests.cs.html#12"><b>12</b>			CurrentOrientation = <i>DeviceOrientation</i>.Portrait;</a>20<a href="../../Xamarin.Forms.Core.UnitTests/MasterDetailFormUnitTests.cs.html#299"><b>299</b>			Device.Info.CurrentOrientation = <i>DeviceOrientation</i>.Portrait;</a>21<a href="../../Xamarin.Forms.Core.UnitTests/MasterDetailFormUnitTests.cs.html#315"><b>315</b>			Device.Info.CurrentOrientation = <i>DeviceOrientation</i>.Landscape;</a>22</div>23</div>24<div class="rA">Xamarin.Forms.Platform.Android (4)</div><div class="rG" id="Xamarin.Forms.Platform.Android"><div class="rF"><div class="rN">Extensions.cs (4)</div>25<a href="../../Xamarin.Forms.Platform.Android/Extensions.cs.html#28"><b>28</b>		internal static <i>DeviceOrientation</i> ToDeviceOrientation(this Orientation orientation)</a>26<a href="../../Xamarin.Forms.Platform.Android/Extensions.cs.html#33"><b>33</b>					return <i>DeviceOrientation</i>.Landscape;</a>27<a href="../../Xamarin.Forms.Platform.Android/Extensions.cs.html#35"><b>35</b>					return <i>DeviceOrientation</i>.Portrait;</a>28<a href="../../Xamarin.Forms.Platform.Android/Extensions.cs.html#37"><b>37</b>					return <i>DeviceOrientation</i>.Other;</a>29</div>30</div>31<div class="rA">Xamarin.Forms.Platform.iOS (6)</div><div class="rG" id="Xamarin.Forms.Platform.iOS"><div class="rF"><div class="rN">Extensions\Extensions.cs (6)</div>32<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#53"><b>53</b>		internal static <i>DeviceOrientation</i> ToDeviceOrientation(this UIDeviceOrientation orientation)</a>33<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#58"><b>58</b>					return <i>DeviceOrientation</i>.Portrait;</a>34<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#60"><b>60</b>					return <i>DeviceOrientation</i>.PortraitDown;</a>35<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#62"><b>62</b>					return <i>DeviceOrientation</i>.LandscapeLeft;</a>36<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#64"><b>64</b>					return <i>DeviceOrientation</i>.LandscapeRight;</a>37<a href="../../Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs.html#66"><b>66</b>					return <i>DeviceOrientation</i>.Other;</a>38</div>39</div>40<div class="rA">Xamarin.Forms.Platform.UAP (4)</div><div class="rG" id="Xamarin.Forms.Platform.UAP"><div class="rF"><div class="rN">WindowsDeviceInfo.cs (4)</div>41<a href="../../Xamarin.Forms.Platform.UAP/WindowsDeviceInfo.cs.html#92"><b>92</b>		static <i>DeviceOrientation</i> GetDeviceOrientation(DisplayOrientations orientations)</a>42<a href="../../Xamarin.Forms.Platform.UAP/WindowsDeviceInfo.cs.html#98"><b>98</b>					return <i>DeviceOrientation</i>.Landscape;</a>43<a href="../../Xamarin.Forms.Platform.UAP/WindowsDeviceInfo.cs.html#102"><b>102</b>					return <i>DeviceOrientation</i>.Portrait;</a>44<a href="../../Xamarin.Forms.Platform.UAP/WindowsDeviceInfo.cs.html#106"><b>106</b>					return <i>DeviceOrientation</i>.Other;</a>45</div>46</div>47<div class="rA">Xamarin.Forms.Platform.WinRT (4)</div><div class="rG" id="Xamarin.Forms.Platform.WinRT"><div class="rF"><div class="rN">WindowsDeviceInfo.cs (4)</div>48<a href="../../Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs.html#92"><b>92</b>		static <i>DeviceOrientation</i> GetDeviceOrientation(DisplayOrientations orientations)</a>49<a href="../../Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs.html#98"><b>98</b>					return <i>DeviceOrientation</i>.Landscape;</a>50<a href="../../Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs.html#102"><b>102</b>					return <i>DeviceOrientation</i>.Portrait;</a>51<a href="../../Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs.html#106"><b>106</b>					return <i>DeviceOrientation</i>.Other;</a>52</div>53</div>
...

Full Screen

DeviceOrientationExtensions.cs.html

Source:DeviceOrientationExtensions.cs.html Github

copy

Full Screen

1<!DOCTYPE html>2<html><head><title>DeviceOrientationExtensions.cs</title><link rel="stylesheet" href="../styles.css"><script src="../scripts.js"></script></head>3<body class="cB" onload="i(18);"><div class="dH">4<table style="width: 100%">5<tr><td>File: <a id="filePath" class="blueLink" href="Xamarin.Forms.Core/DeviceOrientationExtensions.cs" target="_top">DeviceOrientationExtensions.cs</a><br/></td><td></td></tr>6<tr><td>Project: <a id="projectPath" class="blueLink" href="/#Xamarin.Forms.Core" target="_top">Xamarin.Forms.Core\Xamarin.Forms.Core.csproj</a> (Xamarin.Forms.Core)</td><td></td></tr>7</table>8</div>9<div class="cz"><table class="tb" cellpadding="0" cellspacing="0"><tr><td valign="top" align="right"><pre id="ln"></pre></td><td valign="top" align="left"><pre id="code">10<b>using</b> <span class="i n">System</span>.<span class="i n">ComponentModel</span>;11 12<b>namespace</b> <span class="i n">Xamarin</span>.<span class="i n">Forms</span>.<span class="i n">Internals</span>13{14	[<a href="@1@System.Runtime/A.html#ab67c52c634f618d" class="t constructor">EditorBrowsable</a>(<a href="@1@System.Runtime/A.html#1a60f7b04af02e88" class="t t">EditorBrowsableState</a>.<a href="@1@System.Runtime/A.html#043ce0a55050bfc5" class="i field">Never</a>)]15	<b>public static class</b> <a id="3f6bb1f79386f25c" href="R/../../0000000000.html" target="n" data-glyph="0,0" class="t t">DeviceOrientationExtensions</a>16	{17		<b>public static bool</b> <a id="c4368906d6911ab4" href="R/c4368906d6911ab4.html" target="n" data-glyph="220,1" class="i method">IsLandscape</a>(<b>this</b> <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a> <span id="r0 rd" class="r0 r">orientation</span>)18		{19			<b>return</b> <span class="r0 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#289be0727051851f" class="i field">Landscape</a> || <span class="r0 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#b6fcaf1690a4cdbf" class="i field">LandscapeLeft</a> || <span class="r0 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#e03f4427e2a9a523" class="i field">LandscapeRight</a>;20		}21 22		<b>public static bool</b> <a id="83b756b971e9d2d4" href="R/83b756b971e9d2d4.html" target="n" data-glyph="220,1" class="i method">IsPortrait</a>(<b>this</b> <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a> <span id="r1 rd" class="r1 r">orientation</span>)23		{24			<b>return</b> <span class="r1 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#668d3332182cc9a6" class="i field">Portrait</a> || <span class="r1 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#1f71bb5a4e4feae4" class="i field">PortraitDown</a> || <span class="r1 r">orientation</span> == <a href="DeviceOrientation.cs.html#a771844f9214e374" class="t t">DeviceOrientation</a>.<a href="DeviceOrientation.cs.html#a9bd583538d7a0b6" class="i field">PortraitUp</a>;25		}26	}
...

Full Screen

Browser Compatibility

  • DeviceOrientation & DeviceMotion events on IE is fully supported on None of the versions, partially supported on 11-11, and not supported on 5.5-10 IE versions.
  • DeviceOrientation & DeviceMotion events on Edge is fully supported on 12-18, partially supported on 79-111, and not supported on below 79 Edge versions.
  • DeviceOrientation & DeviceMotion events on Firefox is fully supported on None of the versions, partially supported on 6-113, and not supported on 2-5 Firefox versions.
  • DeviceOrientation & DeviceMotion events on Chrome is fully supported on None of the versions, partially supported on 7-114, and not supported on 4-6 Chrome versions.
  • DeviceOrientation & DeviceMotion events on Safari is fully supported on None of the versions, partially supported on None of the versions, and not supported on 3.2-16.4 Safari versions.
  • DeviceOrientation & DeviceMotion events on Opera is fully supported on None of the versions, partially supported on 15-95, and not supported on 9.5-12.1 Opera versions.
  • DeviceOrientation & DeviceMotion events on Safari on iOS is fully supported on None of the versions, partially supported on 4.2-16.4, and not supported on 3.2-4 Safari on iOS versions.
  • DeviceOrientation & DeviceMotion events on Android Browser is fully supported on None of the versions, partially supported on 3-111, and not supported on 2.1-2.2 Android Browser versions.
  • DeviceOrientation & DeviceMotion events on Opera Mobile is fully supported on 12.1-12, partially supported on 64-73, and not supported on 10-11 Opera Mobile versions.
  • DeviceOrientation & DeviceMotion events on Chrome for Android is fully supported on None of the versions, partially supported on 97-111, and not supported on below 97 Chrome for Android versions.
  • DeviceOrientation & DeviceMotion events on Firefox for Android is fully supported on None of the versions, partially supported on 95-110, and not supported on below 95 Firefox for Android versions.
  • DeviceOrientation & DeviceMotion events on Samsung Internet is fully supported on None of the versions, partially supported on 4-20, and not supported on below 4 Samsung Internet versions.
88
Hightooltip

Browser Compatibility Score

Chrome IE
Medium

Browser Support For IE Versions

-
Fully
11-11
Partially
5.5-10
No Support
Chrome Edge
High

Browser Support For Edge Versions

12-18
Fully
79-111
Partially
-
No Support
Chrome Firefox
High

Browser Support For Firefox Versions

-
Fully
6-113
Partially
2-5
No Support
Chrome Chrome
High

Browser Support For Chrome Versions

-
Fully
7-114
Partially
4-6
No Support
Chrome Safari
Low

Browser Support For Safari Versions

-
Fully
-
Partially
3.2-16.4
No Support
Chrome Opera
High

Browser Support For Opera Versions

-
Fully
15-95
Partially
9.5-12.1
No Support
Chrome Safari on iOS
High

Browser Support For Safari on iOS Versions

-
Fully
4.2-16.4
Partially
3.2-4
No Support
Chrome Android Browser
High

Browser Support For Android Browser Versions

-
Fully
3-111
Partially
2.1-2.2
No Support
Chrome Opera Mobile
High

Browser Support For Opera Mobile Versions

12.1-12
Fully
64-73
Partially
10-11
No Support
Chrome Chrome for Android
High

Browser Support For Chrome for Android Versions

-
Fully
97-111
Partially
-
No Support
Chrome Firefox for Android
High

Browser Support For Firefox for Android Versions

-
Fully
95-110
Partially
-
No Support
Chrome Samsung Internet
High

Browser Support For Samsung Internet Versions

-
Fully
4-20
Partially
-
No Support

Debug webpages on the go with LT Debug Chrome extension.

Add to Chrome
LT Browser

Test your website on 3000+ browsers

Test your website on 3000+ real browsers and operating systems for mobile and desktop with the LambdaTest cloud. Perform browser compatibility test for DeviceOrientation & DeviceMotion events and many more web technologies that are a part of your website or web-application.

Last Modified date

2023-03-20

Browser Support for DeviceOrientation & DeviceMotion events

References


Data sourced from

Debug webpages on the go with LT Debug Chrome extension.

Add to Chrome
LT Browser

Debug Your Mobile Websites Faster With LT Browser!

Harness the power of Chromium-based engine to deliver responsive websites and web apps.

Try for free...
Join

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful

LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie