Use runtime query getSdkVersion() for OpenSL ES

Fixes #52
diff --git a/src/common/AudioStreamBuilder.cpp b/src/common/AudioStreamBuilder.cpp
index 777b573..f378a10 100644
--- a/src/common/AudioStreamBuilder.cpp
+++ b/src/common/AudioStreamBuilder.cpp
@@ -31,10 +31,10 @@
 }
 
 bool AudioStreamBuilder::isAAudioRecommended() {
-    const int ANDROID_8_1 = 27; // OC-MR1
     // See https://github.com/google/oboe/issues/40,
-    // AAudio may not be stable on Android 8.0, depending on how it is used.
-    return (getSdkVersion() >= ANDROID_8_1);
+    // AAudio may not be stable on Android O, depending on how it is used.
+    // To be safe, use AAUdio on O_MR1 and above.
+    return (getSdkVersion() >= __ANDROID_API_O_MR1__);
 }
 
 AudioStream *AudioStreamBuilder::build() {
diff --git a/src/opensles/AudioOutputStreamOpenSLES.cpp b/src/opensles/AudioOutputStreamOpenSLES.cpp
index e05962a..406632b 100644
--- a/src/opensles/AudioOutputStreamOpenSLES.cpp
+++ b/src/opensles/AudioOutputStreamOpenSLES.cpp
@@ -109,7 +109,7 @@
      * type, creating it from our original format.
      */
     SLAndroidDataFormat_PCM_EX format_pcm_ex;
-    if (__ANDROID_API__ >= __ANDROID_API_L__) {
+    if (getSdkVersion() >= __ANDROID_API_L__) {
         SLuint32 representation = OpenSLES_ConvertFormatToRepresentation(getFormat());
         // Fill in the format structure.
         format_pcm_ex = OpenSLES_createExtendedFormat(format_pcm, representation);
diff --git a/src/opensles/AudioStreamOpenSLES.cpp b/src/opensles/AudioStreamOpenSLES.cpp
index d81c8a4..0ab0265 100644
--- a/src/opensles/AudioStreamOpenSLES.cpp
+++ b/src/opensles/AudioStreamOpenSLES.cpp
@@ -60,7 +60,7 @@
     LOGI("AudioStreamOpenSLES::open(chans:%d, rate:%d)",
                         mChannelCount, mSampleRate);
 
-    if (__ANDROID_API__ < __ANDROID_API_L__ && mFormat == AudioFormat::Float){
+    if (getSdkVersion() < __ANDROID_API_L__ && mFormat == AudioFormat::Float){
         // TODO: Allow floating point format on API <21 using float->int16 converter
         return Result::ErrorInvalidFormat;
     }
@@ -74,8 +74,7 @@
     // API 21+: FLOAT
     // API <21: INT16
     if (mFormat == AudioFormat::Unspecified){
-        // TODO use runtime check
-        mFormat = (__ANDROID_API__ < __ANDROID_API_L__) ?
+        mFormat = (getSdkVersion() < __ANDROID_API_L__) ?
                   AudioFormat::I16 : AudioFormat::Float;
     }