title: Notification.Builder(context) deprecated Android O
body: <p>Notification.Builder(context) has been deprecated recently with the venue of Notification Channels in Android O. </p>
  
  <p><strong>PROBLEM:</strong>  </p>
  
  <p>After using <code>Notification.Builder(context, StringID)</code> instead of <code>Notification.Builder(context)</code>I did receive a notification to my Android O device.<br>
  However, after trying that on an Android 23 (M), I did not receive a notification. I debugged my code and it just stopped executing once the debugger hit the line post Notification.Builder(context, StringID) on Android 23 (M). </p>
  
  <p><strong>FIX:</strong></p>
  
  <p>To Fix this issue, I used if/else condition to segregate between Android O devices and the rest of other devices. </p>
  
  <p>I have the following code snippet:</p>
  
  <pre><code>Notification.Builder notificationBuilder;
  
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O) {
      notificationBuilder = new Notification.Builder(mContext,
              mContext.getResources().getString(R.string.notification_id_channel));
  } else {
      notificationBuilder = new Notification.Builder(mContext);
  }
  </code></pre>
  
  <p>Lint in Android Studio is displaying the following deprecation line:</p>
  
  <p><a href="https://i.stack.imgur.com/9zHDO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9zHDO.png" alt="enter image description here"></a></p>
  
  <p><strong>QUESTION:</strong></p>
  
  <p>Is there a way to get rid off that deprecation warning line? </p>