Monday, April 4, 2011

how to put clock in silent Mode in android

Button mSilence;
mSilence.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Date mDate = new Date();
int mHours = mDate.getHours();
int mMinutes = mDate.getMinutes();
String mCurrentTime = mHours + ":" + mMinutes;

if(mCurrentTime.equals("11:5"))
{
AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT);
//android.permission.MODIFY_AUDIO_SETTINGS
}

}
});

No comments:

Post a Comment