在Android中获取不同的通话状态
我正在尝试使用 Java 反射来访问 CallManager 并检测呼叫状态,我总是让呼叫空闲。请帮我解决这个问题。 顺便说一句,我使用以下代码来访问 CallManager:
try{
class classCallManager = class.forname("com.android.internal.telephony.CallManager");
Method methodGetInstance = classCallManager .getDeclaredMethod("getInstance");
methodGetInstance.setAccessible(true);
Object objectCallManager = methodGetInstance.invoke(null);
Method methodGetActiveFgCallState = classCallManager.getDeclaredMethod("getActiveFgCallState");
}catch (Exception e) {}
I am trying to use Java reflection to access CallManager and detect the call state which I always get the call idle. Please help me on this.
Btw I use the following code to access CallManager:
try{
class classCallManager = class.forname("com.android.internal.telephony.CallManager");
Method methodGetInstance = classCallManager .getDeclaredMethod("getInstance");
methodGetInstance.setAccessible(true);
Object objectCallManager = methodGetInstance.invoke(null);
Method methodGetActiveFgCallState = classCallManager.getDeclaredMethod("getActiveFgCallState");
}catch (Exception e) {}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以确认,不幸的是,即使尝试获取活动的 fg 调用也会失败:返回值始终为 false
请注意,代码位于 Scala 中
I can confirm that unfortunately even trying to get active fg call fails: the return value is always false
note that the code is in Scala