/**
   * Used to return from the notification to the main activity
   *
   * @return PendingIntent THe intent to create
   */
  private PendingIntent getPendingIntent() {
    Intent intent = new Intent(mController.getApplicationContext(), MainActivity.class);
    intent.setFlags(
        Intent.FLAG_ACTIVITY_CLEAR_TASK
            | Intent.FLAG_ACTIVITY_NO_ANIMATION
            | Intent.FLAG_ACTIVITY_NEW_TASK);

    return PendingIntent.getActivity(
        mController.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  }
 private String getNotificationString() {
   if (mPlayerState.isBuffering()) {
     return mController.getString(R.string.buffering);
   } else {
     if (mSongInfo != null) {
       return mSongInfo.toString();
     } else {
       return mController.getString(R.string.retrieveing_song_details);
     }
   }
 }
  private PendingIntent getBroadcastIntent(String command) {
    PendingIntent pi;

    Intent intent = new Intent(mController.getApplicationContext(), BalataNotifierService.class);
    intent.putExtra("COMMAND", command);

    pi =
        PendingIntent.getService(
            mController.getApplicationContext(), 12345, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    return pi;
  }
  public void stopNotification() {
    NotificationManager notify_manager =
        (NotificationManager)
            mController.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);

    notify_manager.cancel(NOTIFY_ID);
  }
  public void updateNotification() {
    if (!mNotificationVisible) return;

    NotificationManager notify_manager =
        (NotificationManager)
            mController.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);

    notify_manager.notify(NOTIFY_ID, createNotification());
  }
  public Notification createNotification() {
    mNotifyBuild =
        new NotificationCompat.Builder(mController.getApplicationContext())
            .setContentTitle(mController.getString(R.string.balatafm))
            .setSmallIcon(R.drawable.ic_notification)
            .setContentIntent(getPendingIntent());

    mNotifyBuild.setContentText(getNotificationString());

    if (mPlayerState.isBuffering()) {
      mNotifyBuild.setProgress(0, 0, true);
    } else {
      if (mPlayerState.isPlaying()) {
        mNotifyBuild.addAction(R.drawable.player_stop, "Stop", getBroadcastIntent("stop"));
        mNotifyBuild.setOngoing(true);
      } else {
        mNotifyBuild.addAction(R.drawable.player_play, "Play", getBroadcastIntent("play"));
      }
    }

    mNotificationVisible = true;
    return mNotifyBuild.build();
  }