Java Code Examples for com.blankj.utilcode.util.PhoneUtils

The following examples show how to use com.blankj.utilcode.util.PhoneUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Android-UtilCode   Source File: PhoneActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void initView(Bundle savedInstanceState, View view) {
    findViewById(R.id.btn_dial).setOnClickListener(this);
    findViewById(R.id.btn_call).setOnClickListener(this);
    findViewById(R.id.btn_send_sms).setOnClickListener(this);
    findViewById(R.id.btn_send_sms_silent).setOnClickListener(this);
    TextView tvAboutPhone = (TextView) findViewById(R.id.tv_about_phone);
    tvAboutPhone.setText("isPhone: " + PhoneUtils.isPhone()
            + "\ngetIMEI: " + PhoneUtils.getIMEI()
            + "\ngetIMSI: " + PhoneUtils.getIMSI()
            + "\ngetPhoneType: " + PhoneUtils.getPhoneType()
            + "\nisSimCardReady: " + PhoneUtils.isSimCardReady()
            + "\ngetSimOperatorName: " + PhoneUtils.getSimOperatorName()
            + "\ngetSimOperatorByMnc: " + PhoneUtils.getSimOperatorByMnc()
            + "\n获取手机状态信息: " + PhoneUtils.getPhoneStatus()
    );
}
 
Example 2
Source Project: Android-UtilCode   Source File: PhoneActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_dial:
            PhoneUtils.dial("10000");
            break;
        case R.id.btn_call:
            PhoneUtils.call("10000");
            break;
        case R.id.btn_send_sms:
            PhoneUtils.sendSms("10000", "test");
            break;
        case R.id.btn_send_sms_silent:
            PhoneUtils.sendSmsSilent("10000", "test");
            break;
    }
}
 
Example 3
Source Project: QPM   Source File: BasicInfoUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static List<InfoItem> getBaseInfo(Context context) {
    List<InfoItem> result = new ArrayList<>();
    // 基本信息
    result.add(new InfoItem("基本信息"));
    result.add(new InfoItem("是否ROOT", DeviceUtils.isDeviceRooted() ? "是" : "否"));
    result.add(new InfoItem("SDK版本", String.valueOf(DeviceUtils.getSDKVersionName())));
    result.add(new InfoItem("发布版本", Build.VERSION.RELEASE));
    result.add(new InfoItem("AndroidId", DeviceUtils.getAndroidID()));
    result.add(new InfoItem("设备厂商", DeviceUtils.getManufacturer()));
    result.add(new InfoItem("设备类型", DeviceUtils.getModel()));
    result.add(new InfoItem("产品型号", Build.PRODUCT));
    result.add(new InfoItem("主板型号", Build.BOARD));
    result.add(new InfoItem("显示型号", Build.DISPLAY));
    result.add(new InfoItem("序列号", Build.SERIAL));
    try{
        result.add(new InfoItem("IMEI", PhoneUtils.getIMEI()));
        result.add(new InfoItem("IMSI", PhoneUtils.getIMSI()));
    } catch (SecurityException e){
        //用户可能手动拒绝权限
    }
    result.add(new InfoItem("OCCID", getOCCID()));
    result.add(new InfoItem("SIM卡", PhoneUtils.isSimCardReady() ? "有" : "无"));

    // 网络相关
    result.add(new InfoItem("网络信息"));
    result.add(new InfoItem("Wifi名称", getWifiName(context)));
    result.add(new InfoItem("IP地址", NetworkUtils.getIPAddress(true)));
    result.add(new InfoItem("Mac地址", DeviceUtils.getMacAddress()));
    result.add(new InfoItem("运营商", NetworkUtils.getNetworkOperatorName()));
    result.add(new InfoItem("网络状态", getNetworkType()));
    result.add(new InfoItem("系统UA", System.getProperty("http.agent")));
    result.add(new InfoItem("聚美UA", getJMUserAgent(context)));

    //屏幕信息
    result.add(new InfoItem("屏幕信息"));
    result.add(new InfoItem("分辨率", getScreenSize(context)));
    result.add(new InfoItem("真实分辨率", ScreenUtils.getScreenWidth() + "x" + ScreenUtils.getScreenHeight()));
    result.add(new InfoItem("像素密度", String.valueOf(ScreenUtils.getScreenDensity())));
    result.add(new InfoItem("像素密度dp", String.valueOf(ScreenUtils.getScreenDensityDpi())));
    result.add(new InfoItem("屏幕尺寸", String.valueOf(getScreenInch(context) + "英寸")));

    // 硬件信息
    result.add(new InfoItem("硬件信息"));
    result.add(new InfoItem("CPU架构", getCPUType()));
    result.add(new InfoItem("CPU核数", String.valueOf(Runtime.getRuntime().availableProcessors())));
    result.add(new InfoItem("总内存", transferByte2MB(Runtime.getRuntime().totalMemory())));
    result.add(new InfoItem("最大内存", transferByte2MB(Runtime.getRuntime().maxMemory())));
    result.add(new InfoItem("剩余内存", transferByte2MB(Runtime.getRuntime().freeMemory())));
    result.add(new InfoItem("硬件信息", Build.HARDWARE));

    return result;
}