Recently I updated an app to use Notification Channel to display notifications on Oreo as Oreo requires Notification Channel, that works fine but Notification Channels are not supported by older android versions hence I am trying to perform a check to see if you is running on Oreo then use create notification channel function. The problem is when I use the following to check
Build.VERSION_CODES.O
it says it is deprecated? Every old post on internet is referring to Build.VERSION_CODES.O but it is deprecated.
Is there a a way to check this? What should I do?
Not deprecated, but obsolete:
[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;
Instead of using Build.VERSION_CODES.?
use Android.OS.BuildVersionCodes.?
instead:
i.e.
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
{
~~~
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With