最近我更新了一个应用程序,使用Notification Channel在Oreo上显示通知,因为Oreo需要通知频道,但工作正常,但旧版本的Android版本不支持通知频道,因此我试图检查你是否正在运行在奥利奥上然后使用创建通知渠道功能。问题是我使用以下内容检查
Build.VERSION_CODES.O
它说它被弃用了?互联网上的每个旧帖子都指的是Build.VERSION_CODES.O但不推荐使用。
有没有办法检查这个?我该怎么办?
答案 0 :(得分:3)
不推荐使用,但已过时:
<div class="menu-container">
<div class="menu">
<div class="flex-item"><a href="about.html" target="_self">About Us</a></div>
<div class="flex-item"><a href="cakes.html" target="_self">Cakes</a></div>
<div class="flex-item"><a href="cupcakes.html" target="_self">Cupcakes</a></div>
<div class="flex-item"><a href="gallery.html" target="_self">Gallery</a></div>
<div class="flex-item"><a href="ordering.html" target="_self">Prices/Order</a></div>
<div class="flex-item"><a href="search.html" target="_self">Search</a></div>
</div>
</div>
<header class="header-container">
<a href="index.html" target="_self"><img src="TCCLogo.png" class="logo" /></a>
</header>
<div class="flex-container main">
<div class="container">
<div class="carousel">
Here is where I will have the quick gallery/carousel when I get to JS.
</div>
<div class="buttons">
<div class="button">
<a href="cakes.html"><img src="cake.png" /></a>
<p>Check out our delicious cake options!</p>
</div>
<div class="button">
<a href="cupcakes.html"><img src="cupcake.png" /></a>
<p>Check out our delicious cupcake options!</p>
</div>
<div class="button">
<a href="ordering.html"><img src="prices.png" /></a>
<p>Check out our competitive pricing!</p>
</div>
</div>
</div>
</div>
<footer class="footer-container">
<a id="subscribe-link" target="_blank" href="#">
<div class="subscribe">
<p>Subscribe</p>
</div>
</a>
<img src="TCCLogo.png" class="footer-logo" />
</footer>
而不是使用[Register ("O", ApiSince = 26)]
[Obsolete ("This constant will be removed in the future version. Use Android.OS.BuildVersionCodes enum directly instead of this field.")]
public const BuildVersionCodes O = BuildVersionCodes.O;
代替Build.VERSION_CODES.?
:
即
Android.OS.BuildVersionCodes.?