<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhəmməd Zeynallı</title>
    <description>The latest articles on DEV Community by Muhəmməd Zeynallı (@muhemmed).</description>
    <link>https://dev.to/muhemmed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3959704%2F7ffc266a-1d38-4968-99ce-7cb7162d2d0d.jpg</url>
      <title>DEV Community: Muhəmməd Zeynallı</title>
      <link>https://dev.to/muhemmed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhemmed"/>
    <language>en</language>
    <item>
      <title>Pydroid can detect Phone direction!</title>
      <dc:creator>Muhəmməd Zeynallı</dc:creator>
      <pubDate>Tue, 11 Aug 2026 17:52:32 +0000</pubDate>
      <link>https://dev.to/muhemmed/pydroid-can-detect-phone-direction-jn3</link>
      <guid>https://dev.to/muhemmed/pydroid-can-detect-phone-direction-jn3</guid>
      <description>&lt;p&gt;Hello.&lt;br&gt;
In &lt;em&gt;Pydroid 3&lt;/em&gt;, you can't detect your &lt;strong&gt;phone direction&lt;/strong&gt;(&lt;em&gt;portrait&lt;/em&gt; or &lt;em&gt;landspace&lt;/em&gt;) with traditional methods. Pyjnius isn't working, because Pydroid 3 can't print Java code in Terminal. Kivy is working, but only with window.&lt;br&gt;
But you can detect this!&lt;/p&gt;

&lt;p&gt;Python's Shutil module can detect terminal size:&lt;/p&gt;

&lt;p&gt;from shutil import get_terminal_size as size&lt;br&gt;
print(size().columns) &lt;em&gt;# Width, example: 60&lt;/em&gt;&lt;br&gt;
print(size().lines) &lt;em&gt;# Height, example: 33&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now rotate your phone to landspace and print this again.&lt;br&gt;
Print is different😳! Example, 122 and 8! Android don't lock phone orientation 100%!!!!&lt;br&gt;
Now, divide this numbers. Result:&lt;br&gt;
≈1.07&amp;lt;2 in portrait&lt;br&gt;
≈15.25&amp;gt;2 in landspace&lt;/p&gt;

&lt;p&gt;YES! This's detect!&lt;/p&gt;

&lt;p&gt;from shutil import get_terminal_size as size&lt;br&gt;
def portrait():&lt;br&gt;
    return size().columns/size().lines&amp;lt;2&lt;br&gt;
while True:&lt;br&gt;
    print(portrait())&lt;/p&gt;

&lt;p&gt;If you rotatw the phone, result will change!!!!&lt;/p&gt;

</description>
      <category>android</category>
      <category>pydroid</category>
      <category>python</category>
      <category>hack</category>
    </item>
  </channel>
</rss>
