{"id":77,"date":"2022-03-10T18:01:58","date_gmt":"2022-03-10T15:01:58","guid":{"rendered":"https:\/\/onuryasar.online\/blog\/?p=77"},"modified":"2022-03-10T18:01:58","modified_gmt":"2022-03-10T15:01:58","slug":"how-to-prevent-force-dark-mode-in-android","status":"publish","type":"post","link":"https:\/\/onuryasar.online\/blog\/how-to-prevent-force-dark-mode-in-android\/","title":{"rendered":"How to prevent force dark mode in Android?"},"content":{"rendered":"\n<p>We will consider how to prevent the feature of forcing the applications to dark mode, which usually appears on Xiaomi devices.<\/p>\n\n\n\n<p>First of all, we should open <strong>\\android\\app\\src\\main\\res\\values<\/strong> path of our project. The code we will add to the styles.xml file in this directory will prevent the dark mode. So, we can open  <strong>styles.xml<\/strong> file and add <code>&lt;item name=\"android:forceDarkAllowed\">false&lt;\/item><\/code> tag into <code>&lt;style>&lt;\/style><\/code> tag.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/onuryasar.online\/blog\/wp-content\/uploads\/2022\/03\/image.png\" alt=\"dark mode preventation\" class=\"wp-image-72\" width=\"654\" height=\"193\" srcset=\"https:\/\/onuryasar.online\/blog\/wp-content\/uploads\/2022\/03\/image.png 654w, https:\/\/onuryasar.online\/blog\/wp-content\/uploads\/2022\/03\/image-300x89.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><figcaption>This is the final form of styles.xml for preventing dark mode<\/figcaption><\/figure><\/div>\n\n\n\n<p>When we build the application again, devices won&#8217;t be able to force the application to dark mode anymore.<\/p>\n\n\n\n<p><br><br><br><a href=\"https:\/\/onuryasar.online\/blog\/react-native-android-force-dark-mode-engelleme\/\" title=\"https:\/\/onuryasar.online\/blog\/react-native-android-force-dark-mode-engelleme\/\">Yaz\u0131n\u0131n T\u00fcrk\u00e7e versiyonu i\u00e7in t\u0131klay\u0131n.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will consider how to prevent the feature of forcing the applications to dark mode, which usually appears on Xiaomi devices. First of all, we&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/onuryasar.online\/blog\/how-to-prevent-force-dark-mode-in-android\/\">Devam\u0131n\u0131 Oku<span class=\"screen-reader-text\">How to prevent force dark mode in Android?<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":80,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[36,37,38],"class_list":["post-77","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-how-to-prevent-dark-mode-in-android","tag-how-to-prevent-dark-mode-in-react-native","tag-how-to-prevent-dark-mode-in-xiaomi-devices","entry"],"_links":{"self":[{"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":3,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":81,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/posts\/77\/revisions\/81"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/media\/80"}],"wp:attachment":[{"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onuryasar.online\/blog\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}