gpt4 book ai didi

android - 调用语音电话,获得应用程序内的感觉(或隐藏默认电话断开连接的用户界面)

转载 作者:行者123 更新时间:2023-11-30 03:25:51 25 4
gpt4 key购买 nike

目前,当我们通过该应用调用语音电话时,整个屏幕都被调用 UI 占据。有没有办法将通话感觉包含在对话框中并为其提供一些边距,以便用户在通话完成后无需记住按返回键进入应用程序?

基本上我不希望客户需要记住按“后退”按钮。

我正在使用下面的代码调用电话。但不是打开最后一个 Activity ,而是打开第一个启动屏幕。我需要它来隐藏。

编辑:

PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager) this
.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneListener, PhoneCallListener.LISTEN_CALL_STATE);

Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + cabbiePhoneNumber));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

我现在使用 PhoneStateListener 来监听电话状态。

private class PhoneCallListener extends PhoneStateListener {
private boolean isPhoneCalling = false;
String LOG_TAG = "LOGGING 123";
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (TelephonyManager.CALL_STATE_RINGING == state) {
// phone ringing
Log.i(LOG_TAG, "RINGING, number: " + incomingNumber);
}
if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
// active
Log.i(LOG_TAG, "OFFHOOK");
isPhoneCalling = true;
}
if (TelephonyManager.CALL_STATE_IDLE == state) {
// run when class initial and phone call ended,
// need detect flag from CALL_STATE_OFFHOOK
Log.i(LOG_TAG, "IDLE");
if (isPhoneCalling) {
Log.i(LOG_TAG, "restart app");
// restart app
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage(
getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
isPhoneCalling = false;
}
}
}

最佳答案

无法从 SDK 应用程序进行没有内置调用 UI 的语音调用。您必须推出自己的固件才能实现此目的。

关于android - 调用语音电话,获得应用程序内的感觉(或隐藏默认电话断开连接的用户界面),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18269696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com