我想知道如何使用 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
}
}
我是一名优秀的程序员,十分优秀!