【发布时间】:2015-10-21 18:16:35
【问题描述】:
Java 解决方案不是问题:
public boolean killCall(Context context) {
try {
// Get the boring old TelephonyManager
TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// Get the getITelephony() method
Class classTelephony = Class.forName(telephonyManager.getClass().getName());
Method methodGetITelephony = classTelephony.getDeclaredMethod("getITelephony");
// Ignore that the method is supposed to be private
methodGetITelephony.setAccessible(true);
// Invoke getITelephony() to get the ITelephony interface
Object telephonyInterface = methodGetITelephony.invoke(telephonyManager);
// Get the endCall method from ITelephony
Class telephonyInterfaceClass =
Class.forName(telephonyInterface.getClass().getName());
Method methodEndCall = telephonyInterfaceClass.getDeclaredMethod("endCall");
// Invoke endCall()
methodEndCall.invoke(telephonyInterface);
} catch (Exception ex) { // Many things can go wrong with reflection calls
Log.d(TAG,"PhoneStateReceiver **" + ex.toString());
return false;
}
return true;
}
但是如何在 Delphi 中做出同样的解决方案呢?
很遗憾,我没有找到任何解决此问题的指南。
【问题讨论】:
-
不好意思问你为什么不用java代码?
-
@PedroLobito 因为他用 Delphi 而不是 Java 进行开发?
-
我需要在一个用 Delphi 编写(并且必须是)的应用程序中使用它。
-
没听说过在android上运行delphi编写的应用程序,Android大部分是基于Java、DalvikVM或ART运行时的。
-
@t0mm13b 现在你有了。 Delphi 是跨平台的,可以编译到 Win、iOS、OSX 和 Android。
标签: android delphi phone-call delphi-10-seattle