我正在为一所学校开设'紧急拨号器',这个学校的数字我不希望用户看到(因为他们是小孩,如果他们看到他们可能会对他们造成严重破坏的数字! )
经过大量的谷歌搜索后,我发现了一篇关于反映“com.android.internal.telephony.ITelephony”类的文章,这似乎让我更接近处理调用,但是“call(String phonenumber)”方法出现了安装的拨号器屏幕显示数字!如何创建我自己的不显示数字?
编辑:这是我的拨号方法的代码片段 -
private void performDial(String numberString){
if (!numberString.equals("")) {
TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
try {
// Java reflection to gain access to TelephonyManager's
// ITelephony getter
Log.v(TAG, "Get getTeleService...");
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService =(ITelephony) m.invoke(tm);
//
telephonyService.dial(numberString);//only opens dial screen, does not place call
telephonyService.call(numberString);//places call, but opens built in dial screen which shows dialled number
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG,
"FATAL ERROR: could not connect to telephony subsystem");
Log.e(TAG, "Exception object: " + e);
}
}
else
{
errorOut("Empty number field");
}
}