微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 修改为语音信箱直接拨出

修改为语音信箱直接拨出

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
点击状态栏中语音信箱,弹出提示框,选择OK后,直接拨出号码,而不进入拨号界面。
[SOLUTION]
在VoicemailDialog.java中的onCLIck()方法中修改

case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
//Uri numberUri = Uri.parse("voicemail:x");
Uri numberUri = Uri.fROMParts("voicemail", number, null);
Intent intentToDialer = new Intent(Intent.ACTION_DIAL, numberUri);
startActivity(intentToDialer);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}
finish();
break;
修改为:
case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}else{
Uri uri = Uri.fromParts("tel", number, null);
Intent newIntent = new Intent(Intent.ACTION_CALL, uri);
number = PhoneUtils.specialNumberTransfer(number);
newIntent.putExtra(Constants.EXTRA_ACTUAL_NUMBER_TO_DIAL, number);
newIntent.putExtra(Constants.EXTRA_SLOT_ID, mIntent.getIntExtra(GeminiConstants.SLOT_ID_KEY, 0), 0));
PhoneGlobals.getInstance().callController.placeCall(newIntent);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
}
finish();
break;

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top