作者:手机用户2502901925 | 来源:互联网 | 2022-02-17 16:33
1.修改FMRadioService.java 添加:
代码如下:
public static final int MSG_EXIT_FM = 1234;
private Handler sHandler11 = new Handler() {
@Override
public void handleMessage(Message msg) {
FMRadioLogUtils.d(TAG, "sHandler11 = " + msg.what);
switch (msg.what) {
case MSG_EXIT_FM:
android.os.Process.killProcess(android.os.Process.myPid());
break;
}
}
};
2.修改onReceive 方法 在
switchAntennaAsync(mValueHeadSetPlug);
之后添加:
代码如下:
if(mValueHeadSetPlug == 1 && mIsPowerUp )
sHandler11.sendMessageDelayed(sHandler.obtainMessage(MSG_EXIT_FM, FMRadioService.this),(long)1000);
else
sHandler11.removeMessages(MSG_EXIT_FM);