mt6735 未插入耳机时进入收音机出现没有耳机提示框后,插入耳机FM能够...
时间:10-02
整理:3721RD
点击:
[Audio App]未插入耳机时进入收音机出现没有耳机提示框后,插入耳机FM能够自动播放
[DESCRIPTION]
FMAPP中未插入耳机时,进入收音机出现提示后,插入耳机,但FM不自动播放,需要选择按钮后FM才会播放,部分客户
希望插入耳机后自动播放
[SOLUTION]
修改FMRadioActivity.java
1.添加code:
NoantennaDialog mAntennaDialogFragment = null;
private final BroADCastReceiver HEADSET_PLUG = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
int mValueHeadSetPlug = intent.getIntExtra("state", -1);
LogUtils.d(TAG, "HEADSET_PLUG action =" + action + "state=" + intent.getIntExtra("state", -1));
if(mValueHeadSetPlug == 1){
dismissAntennaDialog();
powerUpFM();
}
}
};
2.修改 public void onCreate(Bundle savedInstanceState)
注册reciever:
IntentFiLTEr if2=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
registerReceiver(HEADSET_PLUG, if2);
3.修改 public void onDestroy()
取消注册:
unregisterReceiver(HEADSET_PLUG);
4.修改方法成如下:
public void showNoAntennaDialog() {
mAntennaDialogFragment = NoAntennaDialog.newInstance();
mAntennaDialogFragment.show(mFragmentManager, NO_ANTENNA);
mFragmentManager.executePendingTransactions();
}
5.添加方法:
public void dismissAntennaDialog(){
if(mAntennaDialogFragment != null ){
mAntennaDialogFragment.dismiss();
mFragmentManager.executePendingTransactions();
mAntennaDialogFragment=null;
}
}
6.修改方法 public void noAntennaContinue() 和 public void noAntennaCancel()
在最后添加:mAntennaDialogFragment=null;
[DESCRIPTION]
FMAPP中未插入耳机时,进入收音机出现提示后,插入耳机,但FM不自动播放,需要选择按钮后FM才会播放,部分客户
希望插入耳机后自动播放
[SOLUTION]
修改FMRadioActivity.java
1.添加code:
NoantennaDialog mAntennaDialogFragment = null;
private final BroADCastReceiver HEADSET_PLUG = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
int mValueHeadSetPlug = intent.getIntExtra("state", -1);
LogUtils.d(TAG, "HEADSET_PLUG action =" + action + "state=" + intent.getIntExtra("state", -1));
if(mValueHeadSetPlug == 1){
dismissAntennaDialog();
powerUpFM();
}
}
};
2.修改 public void onCreate(Bundle savedInstanceState)
注册reciever:
IntentFiLTEr if2=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
registerReceiver(HEADSET_PLUG, if2);
3.修改 public void onDestroy()
取消注册:
unregisterReceiver(HEADSET_PLUG);
4.修改方法成如下:
public void showNoAntennaDialog() {
mAntennaDialogFragment = NoAntennaDialog.newInstance();
mAntennaDialogFragment.show(mFragmentManager, NO_ANTENNA);
mFragmentManager.executePendingTransactions();
}
5.添加方法:
public void dismissAntennaDialog(){
if(mAntennaDialogFragment != null ){
mAntennaDialogFragment.dismiss();
mFragmentManager.executePendingTransactions();
mAntennaDialogFragment=null;
}
}
6.修改方法 public void noAntennaContinue() 和 public void noAntennaCancel()
在最后添加:mAntennaDialogFragment=null;