private void onConnectionStatusChanged(int oldStatus,int status){
  if (sSettingsMgr.showStatusIcon) {
    NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
    builder.setWhen(System.currentTimeMillis());
switch (status) {
case XmppManager.CONNECTED:
      builder.setContentText(getString(R.string.main_service_connected,getConnectionStatusAction()));
    builder.setSmallIcon(getImageStatus(STATUS_ICON_GREEN));
  break;
case XmppManager.CONNECTING:
builder.setContentText(getString(R.string.main_service_connecting));
builder.setSmallIcon(getImageStatus(STATUS_ICON_ORANGE));
break;
case XmppManager.DISCONNECTED:
builder.setContentText(getString(R.string.main_service_disconnected));
builder.setSmallIcon(getImageStatus(STATUS_ICON_RED));
break;
case XmppManager.DISCONNECTING:
builder.setContentText(getString(R.string.main_service_disconnecting));
builder.setSmallIcon(getImageStatus(STATUS_ICON_ORANGE));
break;
case XmppManager.WAITING_TO_CONNECT:
case XmppManager.WAITING_FOR_NETWORK:
builder.setContentText(getString(R.string.main_service_waiting_to_connect) + "\n" + getConnectionStatusAction());
builder.setSmallIcon(getImageStatus(STATUS_ICON_BLUE));
break;
default :
return;
}
builder.setContentIntent(sPendingIntentLaunchApplication);
builder.setContentTitle(Tools.APP_NAME);
startForeground(NOTIFICATION_CONNECTION,builder.getNotification());
}
}

private void onConnectionStatusChanged ( int oldStatus , int status ) { if ( sSettingsMgr . showStatusIcon ) { NotificationCompat . Builder builder = new NotificationCompat . Builder ( this ) ; builder . setWhen ( System . currentTimeMillis ( ) ) ; switch ( status ) { case XmppManager . CONNECTED : builder . setContentText ( getString ( R . string . main_service_connected , getConnectionStatusAction ( ) ) ) ; builder . setSmallIcon ( getImageStatus ( STATUS_ICON_GREEN ) ) ; break ; case XmppManager . CONNECTING : builder . setContentText ( getString ( R . string . main_service_connecting ) ) ; builder . setSmallIcon ( getImageStatus ( STATUS_ICON_ORANGE ) ) ; break ; case XmppManager . DISCONNECTED : builder . setContentText ( getString ( R . string . main_service_disconnected ) ) ; builder . setSmallIcon ( getImageStatus ( STATUS_ICON_RED ) ) ; break ; case XmppManager . DISCONNECTING : builder . setContentText ( getString ( R . string . main_service_disconnecting ) ) ; builder . setSmallIcon ( getImageStatus ( STATUS_ICON_ORANGE ) ) ; break ; case XmppManager . WAITING_TO_CONNECT : case XmppManager . WAITING_FOR_NETWORK : builder . setContentText ( getString ( R . string . main_service_waiting_to_connect ) + "\n" + getConnectionStatusAction ( ) ) ; builder . setSmallIcon ( getImageStatus ( STATUS_ICON_BLUE ) ) ; break ; default : return ; } builder . setContentIntent ( sPendingIntentLaunchApplication ) ; builder . setContentTitle ( Tools . APP_NAME ) ; startForeground ( NOTIFICATION_CONNECTION , builder . getNotification ( ) ) ; } }
updates the status about the service state ( and the status bar )
