티스토리 뷰

SWDesk/App

[Android] Generating Beep

inhae 2021. 7. 31. 20:44

비프음(경고음) 발생 코드

 

    SoundPool mPool;
    int mdDok;
    AudioManager mAm;
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState){

		...
        mPool = new SoundPool(1, AudioManager.STREAM_ALARM, 0);
        mdDok = mPool.load(this, R.raw.zxing_beep, 1);
        mAm = (AudioManager)getSystemService(AUDIO_SERVICE);
        ...

    }
    
    private void DoSomeJob(){
    	...
        mPool.play(mdDok, 1, 1, 0, beepNumber-1, 1);
        ...
    }
반응형

'SWDesk > App' 카테고리의 다른 글

[Android] HTTP POST Request  (0) 2021.08.22
[Android] Displaying AlertDialog  (0) 2021.08.14
[Android] Alphanumeric 확인  (0) 2021.07.17
[Android] WebAccess, Kotlin  (0) 2021.07.17
RecyclerView Example  (0) 2021.05.31