How to detect Samsung S10 5G is running on 5G network?

前端 未结 5 783
一整个雨季
一整个雨季 2021-01-07 01:24

Android Q added a new network type, NETWORK_TYPE_NR, for 5G, it is not available for Android Pie. Yet the just released Samsung S10 5G has fully supported 5G function, it ca

5条回答
  •  不要未来只要你来
    2021-01-07 02:08

    Couldn't add this as a comment, but as @Pavel Machala said, looking at the ServiceState class in the AOSP yields the following:

    /**
     * Get the NR 5G status of the mobile data network.
     * @return the NR 5G status.
     * @hide
     */
    public @NRStatus int getNrStatus() {
        final NetworkRegistrationState regState = getNetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        if (regState == null) return NetworkRegistrationState.NR_STATUS_NONE;
        return regState.getNrStatus();
    }
    

提交回复
热议问题