gpt4 book ai didi

android - 如何创建可以使用拨号盘启动的应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 12:40:00 27 4
gpt4 key购买 nike


我想知道如何使用 Dialpad 中的一些代码启动我的 android 应用程序。就像你 ##3214789650##它从你的星系启动 angryGps 应用程序。
如何实现?

谢谢。

最佳答案

试试这个。使用广播接收器来听去电号码:

list .xml

uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>


<receiver android:name=".OutgoingCallReceiver">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>

OutgoingCallReceiver.java

public class OutgoingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Bundle bundle = intent.getExtras();
if (null == bundle)
return;
// outgoingNumber=intent.getStringExtra(Intent.ACTION_NEW_OUTGOING_CALL);
String phoneNubmer = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
//START APPLICATION HERE
}
}

关于android - 如何创建可以使用拨号盘启动的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10226995/

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