1

我如何使用 Android 应用程序检查 Android 平板电脑,它是否具有 sim 卡 (4g) 功能。因为我创建了一个必须执行不同任务的应用程序,具体取决于它是否具有 simcard (4g) 电话功能。

4

1 回答 1

2

您必须使用 TelephoneyManager 来测试它是否有 simcard 插槽。可以试试下面的代码。更多细节从这里

public static boolean isSimSupport(Context context)
    {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);  //gets the current TelephonyManager
        return !(tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT);

    }
于 2020-05-06T12:11:09.757 回答