- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有什么方法可以在两张 SIM 卡上获得信号强度。我搜索了很多,但找不到任何解决方案。也许有什么方法可以在第二张 SIM 卡上注册接收器?我在 Android 5.0 上工作,我知道这个版本的 Android 官方不支持双卡解决方案。我发现只有这个几乎适合我: Check whether the phone is dual SIM Android dual SIM signal strength
第二个链接提供了一些方法,但我无法使用它,因为方法 TelephonyManager.listenGemini 不可用
有什么帮助吗?
最佳答案
请注意:以下内容特定于某些 Android 5.0 设备。它在 Android 5.0 中使用隐藏界面,在早期和以后的版本中将无法使用。特别是,当 API 在 API 22 中公开时,订阅 ID 从 long
更改为 int
(无论如何您都应该使用官方 API)。
对于 HTC M8 上的 Android 5.0,您可以尝试以下方法获取两张 sim 卡的信号强度:
重写 PhoneStateListener
及其 protected 内部变量 long mSubId
。由于 protected 变量是隐藏的,因此您需要使用反射。
public class MultiSimListener extends PhoneStateListener {
private Field subIdField;
private long subId = -1;
public MultiSimListener (long subId) {
super();
try {
// Get the protected field mSubId of PhoneStateListener and set it
subIdField = this.getClass().getSuperclass().getDeclaredField("mSubId");
subscriptionField.setAccessible(true);
subscriptionField.set(this, subId);
this.subId = subId;
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
} catch (IllegalArgumentException e) {
}
}
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// Handle the event here, subId indicates the subscription id if > 0
}
}
您还需要从 SubscriptionManager
获取 Activity 订阅 ID 列表以实例化该类。 SubscriptionManager
再次隐藏在 5.0 中。
final Class<?> tmClassSM = Class.forName("android.telephony.SubscriptionManager");
// Static method to return list of active subids
Method methodGetSubIdList = tmClassSM.getDeclaredMethod("getActiveSubIdList");
long[] subIdList = (long[])methodGetSubIdList.invoke(null);
然后您可以遍历 subIdList
以创建 MultiSimListener
的实例。例如
MultiSimListener listener[subIdList[i]] = new MultiSimListener(subIdList[i]);
然后您可以像往常一样为每个监听器调用 TelephonyManager.listen
。
您需要在代码中添加错误和 Android 版本/设备检查,因为它仅适用于特定设备/版本。
关于安卓信号强度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31782191/
我正在开发一个录音机应用程序。我想知道在录制音频时有什么方法可以找到音频的强度。我不想将录音保存在任何地方。我只想向用户展示麦克风捕捉到的声音是否大于预定义的阈值。 假设如果声音低于 2 分贝,它应该
我正在尝试让一个基本服务器(从 Beginning Python 复制)来发送一个 str。 错误: c.send( "XXX" ) TypeError: must be bytes or buffe
我陷入了一个问题,不知道去哪里看。我需要增加图像中特定颜色的强度,例如 R、G 或蓝色。当我这样做时,某些颜色无法正确呈现。 下面是我为测试拍摄的图像: 现在当我像绿色一样增加时: A = Color
我不希望我的背景图片太模糊。没有调整模糊强度的属性吗? let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) blurEffect
我使用 OpenCV 2.4.11+Qt 并尝试制作视频并更改红色/蓝色或绿色 channel 的强度,但没有找到任何功能或设置来执行此操作。有谁知道如何做到这一点? 最佳答案 如果您只想更改一个特定
当我有 x、y、强度时,我不知道如何创建热图(或等高线图)。我有一个看起来像这样的文件: 0,1,6 0,2,10 .... 到目前为止: with open('eye_.txt', 'r') as
有谁有一些可以在 iPhone 应用程序中使用的代码,让我可以看到 wifi 的强度吗?我有一个连接密集型操作,并且希望它们不在不稳定区域 最佳答案 这可能会帮助您走上正确的道路...... http
当从 RGB 转换为灰度时,据说应该对 R、G 和 B channel 应用特定的权重。这些权重是:0.2989、0.5870、0.1140。 据说这是因为人类对这三种颜色的感知/感受不同。有时也有人
Eclipse SSH key 生成屏幕(常规 -> 网络连接 -> SSH2)生成 1024 位 RSA key ,该 key 太弱而无法使用 ( http://news.netcraft.com/
当从 RGB 转换为灰度时,据说应该对 R、G 和 B channel 应用特定的权重。这些权重是:0.2989、0.5870、0.1140。 据说这是因为人类对这三种颜色的感知/感受不同。有时也有人
我们的网络应用程序使用 the Vibrate API对于微妙的按钮按下效果: window.navigator.vibrate(5); 但在我的新手机上,感觉不那么微妙,更像是我的手机正试图从我手中
我的应用程序应扫描周围的 Wifi 信号并列出网络名称及其 RSSI。 我在谷歌上找不到任何关于如何做的线索。有人可以举个例子或者至少指出其他地方我可以找到答案吗? 最佳答案 我认为这不可能!不管是
所以我的图像有一些黑点,它们看起来很简单,所以我想我可以创建一个亮度图,将其反转,然后将其应用到我的图像以消除黑点。然而,我所能找到的只有两种均衡方法:均衡整个图像(使用直方图)或将图像分割成深色和浅
我是一名优秀的程序员,十分优秀!