是否可以检查用户设备是否支持GSM /全球网络?
我尝试过:
pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_GSM)
然而,它似乎不起作用,因为它返回false
我的设备在CDMA网络上(但也有一个GSM无线电)。
似乎没有万无一失的方法来检查用户设备是否支持" Global"能力。
手机中的功能日志(我在Verizon上)。
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977d20 com.verizon.hardware.telephony.ehrpd fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977db8 android.hardware.location fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977e38 android.hardware.screen.landscape fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977ec8 android.hardware.screen.portrait fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977f58 android.hardware.camera.any fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42977fe0 android.hardware.bluetooth fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978060 android.hardware.touchscreen.multitouch.distinct fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978110 com.sec.feature.gearmanager fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978198 com.sec.feature.hovering_ui fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978220 android.hardware.microphone fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429782a8 com.verizon.hardware.telephony.lte fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978338 android.hardware.camera.autofocus fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429783c8 android.software.live_wallpaper fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978458 com.vzw.hardware.ehrpd fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429784d0 com.vmware.mvp fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978538 android.hardware.faketouch fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429785b8 android.hardware.camera fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978638 com.sec.feature.minimode fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429786b8 android.software.sip.voip fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978738 android.hardware.sensor.proximity fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429787c8 com.sec.feature.irda_service fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978850 android.hardware.telephony.cdma fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429788e0 android.hardware.wifi fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978958 android.hardware.location.network fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429789e8 android.hardware.nfc fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978a60 com.sec.android.mdm fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978ad8 android.hardware.bluetooth_le fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978b60 android.software.input_methods fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978be8 android.hardware.sensor.gyroscope fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978c78 com.sec.feature.sensorhub fl=0x2}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978cf8 com.sec.feature.yosemite fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978d78 android.hardware.wifi.direct fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978e00 android.hardware.usb.accessory fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978e88 android.hardware.sensor.light fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978f10 android.software.app_widgets fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42978f98 android.hardware.camera.flash fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979020 com.sec.feature.barcode_emulator fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429790b0 android.hardware.telephony fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979130 com.sec.feature.flashbar fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429791b0 android.software.sip fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979228 android.hardware.touchscreen.multitouch.jazzhand fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429792d8 android.hardware.sensor.barometer fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979368 android.hardware.usb.host fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429793e8 android.hardware.touchscreen.multitouch fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979488 android.hardware.sensor.compass fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979518 com.vzw.hardware.lte fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979590 android.software.home_screen fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979618 com.sec.feature.multiwindow.phone fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429796a8 com.amazon.fv.feature.preload fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979730 android.hardware.location.gps fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429797b8 com.sec.feature.multiwindow fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979840 android.hardware.camera.front fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429798c8 android.hardware.touchscreen fl=0x1}
04-10 11:44:24.295 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{42979950 android.hardware.sensor.accelerometer fl=0x1}
04-10 11:44:24.305 14651-14651/com.globalreadycheck.app E/FEATURE INFO:﹕ FeatureInfo{429799e8 glEsVers=3.0 fl=0x0}
答案 0 :(得分:0)
您可以尝试这样:
FeatureInfo[] fInfo = packageManager.getSystemAvailableFeatures();
while(i < fInfo.length)
{
if(fInfo[i].toString().equal(FEATURE_TELEPHONY_GSM))
Toast.makeText(getApplicationContext(), "GSM supported", Toast.LENGTH_SHORT).show();
if(fInfo[i].toString().equal(FEATURE_TELEPHONY_CDMA))
Toast.makeText(getApplicationContext(), "CDMA supported", Toast.LENGTH_SHORT).show();
}