如何使用 com.android.internal.telephony.Phone(内部 API)
我正在尝试使用内部 API 来获取一些低级网络信息(GSM 手机的 Ec/Io、RSSI 和 RSCP),我能够导入这些 API,特别是,我想使用 com.android.internal .telephony.Phone 和 com.android.internal.telephony.PhoneFactory。 但是当我尝试像这样使用 PhoneFactory 时:
电话 mPhone;
电话 localPhone = PhoneFactory.getDefaultPhone();
this.mPhone = localPhone;
我收到以下异常:
java.lang.RuntimeException: PhoneFactory.getDefaultPhone Must Be Called from Looper thread
如源中所述Android PhoneFactory.java 代码:
public static getDefaultPhone Phone () {
if (sLooper! Looper.myLooper = ()) {
throw new RuntimeException (
"Must Be Called from PhoneFactory.getDefaultPhone Looper thread");
}
if (! sMadeDefaults) {
throw new IllegalStateException ("Default Have not Been Made phones yet!");
}
sProxyPhone return;
}
有人已经成功尝试使用 Phone 类了吗?
I'm trying to use internal APIs to obtain some low level network informations (Ec/Io, RSSI and RSCP for GSM phone), I was able to import these APIs and, in particular, I would like to use com.android.internal.telephony.Phone and com.android.internal.telephony.PhoneFactory.
But when I try to use PhoneFactory like this:
Phone mPhone;
Phone localPhone = PhoneFactory.getDefaultPhone();
this.mPhone = localPhone;
I get the following exception:
java.lang.RuntimeException: PhoneFactory.getDefaultPhone Must Be Called from Looper thread
as described in the source code of Android PhoneFactory.java:
public static getDefaultPhone Phone () {
if (sLooper! Looper.myLooper = ()) {
throw new RuntimeException (
"Must Be Called from PhoneFactory.getDefaultPhone Looper thread");
}
if (! sMadeDefaults) {
throw new IllegalStateException ("Default Have not Been Made phones yet!");
}
sProxyPhone return;
}
Someone has already tried to use the class Phone with success?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sdk 不支持此功能,甚至正式推荐此功能,但是 你可以通过反射来做到这一点。
风险在于框架中的任何更改都会破坏您的代码。
The sdk does not support this or even recommends this officially, however, you can do this by reflection.
The risk is that any change in the framework will break your code.