package com.quyunshuo.androidbaseframemvvm.base.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;

import com.quyunshuo.androidbaseframemvvm.base.BaseApplication;


public class SimNetworkUtils {
    private static final String TAG = "SimNetworkUtils";

    @SuppressLint("MissingPermission")
    public static boolean test(){
        TelephonyManager tm = (TelephonyManager) BaseApplication.context.getSystemService(Context.TELEPHONY_SERVICE);
        String simSerialNumber = null;
        if (tm != null) {
            try {
                simSerialNumber = tm.getSimSerialNumber();
            }catch (Exception e){
                return false;
            }

        }
        if(simSerialNumber == null || simSerialNumber.equals("")) {
            return false;
        }
        return true;
    }

    public static boolean test2(){
        ConnectivityManager cm =(ConnectivityManager)BaseApplication.context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo woin=null;
        try {
             woin = cm.getActiveNetworkInfo() ;
        }catch (Exception e){
            return false;
        }

        if (woin ==null) {
            return false;
        }
        return true;
    }





}
