public static Notification createNotification(
     Context context,
     int iconId,
     int tickerTextResId,
     int contentTextResId,
     PendingIntent pendingIntent) {
   String tickerText = context.getString(tickerTextResId);
   String contentText = context.getString(contentTextResId);
   if (ApiHelper.getAPILevel() < 11) {
     Notification notification = new Notification();
     notification.tickerText = tickerText;
     notification.when = System.currentTimeMillis();
     //noinspection deprecation
     notification.icon = iconId;
     notification.contentIntent = pendingIntent;
     // Google removed setLatestEventInfo in sdk 23.
     //noinspection TryWithIdenticalCatches
     try {
       Method method =
           Notification.class.getMethod(
               "setLatestEventInfo",
               Context.class,
               CharSequence.class,
               CharSequence.class,
               PendingIntent.class);
       method.invoke(notification, context, tickerText, contentText, pendingIntent);
     } catch (NoSuchMethodException e) {
       Log.v(TAG, e.getMessage(), e);
     } catch (IllegalAccessException e) {
       Log.v(TAG, e.getMessage(), e);
     } catch (InvocationTargetException e) {
       Log.v(TAG, e.getMessage(), e);
     }
     return notification;
   } else if (ApiHelper.getAPILevel() < 16) {
     return Api11Helper.createNotification(
         context, iconId, tickerText, contentText, pendingIntent);
   } else {
     return Api16Helper.createNotification(
         context, iconId, tickerText, contentText, pendingIntent);
   }
 }