How to find out whether a particular device has SIM Hardware support?

前端 未结 1 1466
无人共我
无人共我 2021-02-09 00:02

I wanted to disable features related to CALL and SMS in my application based on whether SIM hardware is present or not. Now a beginners approach towards this will be checking th

1条回答
  •  遇见更好的自我
    2021-02-09 00:28

    Use

    PackageManager pm = this.getPackageManager();
    boolean hasTelephony=pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
    

    Edit:

    Try using

    TelephonyManager.getLine1Number()
    

    If this returns null then you wont have telephony feature. Have not tried. give it a shot

    0 讨论(0)
提交回复
热议问题