关于Build类的介绍

这个类为一个获取设备一些初始化信息的类,该类的主要信息都是通过一些static的字段获得:

public static final String BOARD The name of the underlying board, like "goldfish".(设备厂商)
public static final String BOOTLOADER The system bootloader version number.
public static final String BRAND The brand (e.g., carrier) the software is customized for, if any.
public static final String CPU_ABI The name of the instruction set (CPU type + ABI convention) of native code.

import android.content.Context;
import android.telephony.TelephonyManager;

/**
* 读取手机设备信息测试代码
* http://www.souapp.com 搜应用网 
* song2c@163.com
* 宋立波
*/
public class PhoneInfo {

private TelephonyManager telephonyManager;
/**
* 国际移动用户识别码
*/
private String IMSI;
private Context cxt;
public PhoneInfo(Context context) {
cxt=context;
telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
}

/**
* 获取电话号码
*/
public String getNativePhoneNumber() {
String NativePhoneNumber=null;
NativePhoneNumber=telephonyManager.getLine1Number();
return NativePhoneNumber;
}

/**
* 获取手机服务商信息
*/
public String getProvidersName() {
String ProvidersName = "N/A";
try{
IMSI = telephonyManager.getSubscriberId();
// IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。
System.out.println(IMSI);
if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
ProvidersName = "中国移动";
} else if (IMSI.startsWith("46001")) {
ProvidersName = "中国联通";
} else if (IMSI.startsWith("46003")) {
ProvidersName = "中国电信";
}
}catch(Exception e){
e.printStackTrace();
}
return ProvidersName;
}

public String getPhoneInfo(){
TelephonyManager tm = (TelephonyManager)cxt.getSystemService(Context.TELEPHONY_SERVICE);
StringBuilder sb = new StringBuilder();

sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId());
sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion());
sb.append("\nLine1Number = " + tm.getLine1Number());
sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso());
sb.append("\nNetworkOperator = " + tm.getNetworkOperator());
sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName());
sb.append("\nNetworkType = " + tm.getNetworkType());
sb.append("\nPhoneType = " + tm.getPhoneType());
sb.append("\nSimCountryIso = " + tm.getSimCountryIso());
sb.append("\nSimOperator = " + tm.getSimOperator());
sb.append("\nSimOperatorName = " + tm.getSimOperatorName());
sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber());
sb.append("\nSimState = " + tm.getSimState());
sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId());
sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber());
return sb.toString();
}
}

Android 关于android.os.Build介绍的更多相关文章

  1. android手机状态解释,比方android.os.Build.VERSION.SDK

    //BOARD 主板 String phoneInfo = "BOARD: " + android.os.Build.BOARD; phoneInfo += ", BOO ...

  2. 【Android】Field requires API level 4 (current min is 1): android.os.Build.VERSION#SDK_INT

    刚遇到了这个问题: Field requires API level 4 (current min is 1): android.os.Build.VERSION#SDK_INT 解决方法: 修改 A ...

  3. Android系统性能调优工具介绍

    http://blog.csdn.net/innost/article/details/9008691 经作者授权,发表Tieto某青年牛的一篇<程序员>大作. Android系统性能调优 ...

  4. Android Studio 经常使用功能介绍

    为了简化 Android 的开发力度,Google 决定将重点建设 Android Studio 工具.Google 会在今年年底停止支持其它集成开发环境.比方 Eclipse. Android St ...

  5. 怎么通过activity里面的一个按钮跳转到另一个fragment(android FragmentTransaction.replace的用法介绍)

    即:android FragmentTransaction.replace的用法介绍 Fragment的生命周期和它的宿主Activity密切相关,几乎和宿主Activity的生命周期一致,他们之间最 ...

  6. 【Android 基础】Animation 动画介绍和实现

    在前面PopupWindow 实现显示仿腾讯新闻底部弹出菜单有用到Animation动画效果来实现菜单的显示和隐藏,本文就来介绍下吧. 1.Animation 动画类型 Android的animati ...

  7. Android的多媒体框架OpenCore介绍

    网上资料很少, 不过还是找到一个比较详细的说明: 特地在此整理了下: 地址:http://blog.csdn.net/djy1992/article/details/9339787 分为几个阶段: 1 ...

  8. Android 异常 android.os.NetworkOnMainThreadException

    近期在实现一个Android下的数据採集的SDK,收集用户使用数据使用HTTP发送到云平台.进行数据分析.但在发送数据时报例如以下错误: Caused by: android.os.NetworkOn ...

  9. Android开发之深入理解Android Studio构建文件build.gradle配置

    摘要: 每周一次,深入学习Android教程,TeachCourse今天带来的一篇关于Android Studio构建文件build.gradle的相关配置,重点学习几个方面的内容:1.applica ...

随机推荐

  1. PHP 结合前端 ajax 爬取网站信息后, 向指定用户发送指定短信;

    <?php /** * Description * @authors Your Name (you@example.org) * # 根据时时彩的最新一期的号码, 判断如果为首尾同号则发送短信 ...

  2. PAT 1142 Maximal Clique

    A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the ...

  3. MySQL 分库、分表

    Mysql Sharding 前言 1)Sharding是按照一定规则重新分布数据的方式 2)解决单机写入压力过大和容量问题 3)  解决单机查询慢的问题 4)本文主要根据用户登录场景分析 Shard ...

  4. Switch Game

    Problem Description There are many lamps in a line. All of them are off at first. A series of operat ...

  5. 使用AtomicInteger原子类代替i++线程安全操作

    Java中自增自减操作不具原子性,在多线程环境下是线程不安全的,可以使用使用AtomicInteger原子类代替i++,i--操作完成多线程线程安全操作. 下面是等于i++多线程的自增操作代码: pu ...

  6. hello2 source analisis(notes)

    该hello2应用程序是一个Web模块,它使用Java Servlet技术来显示问候语和响应.使用文本编辑器查看应用程序文件,也可以使用NetBeans IDE. 此应用程序的源代码位于 _tut-i ...

  7. Memcached的Web管理工具MemAdmin(待实践)

    Memcached的Web管理工具有很多,但是最好用的应该是MemAdmin.基于PHP5开发,所以部署时要注意环境. 介绍:http://www.junopen.com/memadmin/ 下载:h ...

  8. Setting .xap MIME Type for Silverlight

    http://www.adefwebserver.com/dotnetnukehelp/misc/Silverlight/SettingMimeType.html Windows 2003: In I ...

  9. Waiting For Debugger

    在eclipse中进行调试时常常出现以下这种提示:Application  (app名称)  is waiting for the debugger to attach 正常情况下.会非常快进入应用调 ...

  10. [React Native] Prevent the On-screen Keyboard from Covering up Text Inputs

    When you bring up the on screen keyboard in a mobile app, it will cover any text input or buttons on ...