当前位置:编程学习 > wap >>

android 录音时,怎么实现来闹钟录音不停止

来闹钟会调用onPause()停止录音,不停止该如何处理?谢谢~(还附加了调用关系)

    protected void onPause() {
        // Stop listening for phone state changes.
        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        telephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
        if(Recorder.PLAYING_STATE != mRecorder.state()) 
        {
            mSampleInterrupted = mRecorder.state() == Recorder.RECORDING_STATE;
            mRecorder.stop();
        }
        
        super.onPause();
    }



SoundRecorder.onPause() line: 711
SoundRecorder(Activity).performPause() line: 3842
Instrumentation.callActivityOnPause(Activity) line: 1190
ActivityThread.performPauseActivity(ActivityThread$ActivityRecord, boolean, boolean) line: 3335
ActivityThread.performPauseActivity(IBinder, boolean, boolean) line: 3305
ActivityThread.handlePauseActivity(IBinder, boolean, boolean, int) line: 3288
ActivityThread.access$2500(ActivityThread, IBinder, boolean, boolean, int) line: 125
ActivityThread$H.handleMessage(Message) line: 2040
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 878
ZygoteInit.main(String[]) line: 636
NativeStart.main(String[]) line: not available [native method]

--------------------编程问答-------------------- 在闹钟里去掉audiofocus相关机制,不过这会影响音乐闹钟铃声并发问题。如果觉得这不是很重要 --------------------编程问答-------------------- 强行抢占 音频焦点 百度一下
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,