private boolean ring(float volume){
  boolean res=false;
  if (volume > 0) {
    clearMediaPlayer();
    initMediaPlayer();
    final AudioManager audioManager=(AudioManager)sContext.getSystemService(Context.AUDIO_SERVICE);
    if (mCanRing && audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0) {
      try {
        mMediaPlayer.prepare();
      }
 catch (      Exception e) {
        mCanRing=false;
      }
      mMediaPlayer.setVolume(volume / 100,volume / 100);
      if (!mMediaPlayer.isPlaying()) {
        mMediaPlayer.start();
      }
      res=true;
    }
  }
 else {
    mVibrator.vibrate(VIB_PATTERN,0);
    res=true;
  }
  if (res) {
    sMainService.displayRingingNotification();
  }
  return res;
}

private boolean ring ( float volume ) { boolean res = false ; if ( volume > 0 ) { clearMediaPlayer ( ) ; initMediaPlayer ( ) ; final AudioManager audioManager = ( AudioManager ) sContext . getSystemService ( Context . AUDIO_SERVICE ) ; if ( mCanRing && audioManager . getStreamVolume ( AudioManager . STREAM_ALARM ) != 0 ) { try { mMediaPlayer . prepare ( ) ; } catch ( Exception e ) { mCanRing = false ; } mMediaPlayer . setVolume ( volume / 100 , volume / 100 ) ; if ( ! mMediaPlayer . isPlaying ( ) ) { mMediaPlayer . start ( ) ; } res = true ; } } else { mVibrator . vibrate ( VIB_PATTERN , 0 ) ; res = true ; } if ( res ) { sMainService . displayRingingNotification ( ) ; } return res ; }
makes the phone ring
