Android 获取设备信息

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if (tm == null) {

return “”;

}

return “” + tm.getNetworkOperatorName();

}

//sim卡序列号

public static String getSimSerialNumber(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if (tm == null) {

return “”;

}

return “” + tm.getSimSerialNumber();

}

//IMSI

public static String getSubscriberId(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if (tm == null) {

return “”;

}

return “” + tm.getSubscriberId();

}

//sim卡所在国家

public static String getNetworkCountryIso(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if (tm == null) {

return “”;

}

return “” + tm.getNetworkCountryIso();

}

//运营商编号。

public static String getNetworkOperator(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if (tm == null) {

return “”;

}

return tm.getNetworkOperator();

}

//android 获取当前手机型号

public static String getPhoneModel(Context context) {

Build bd = new Build();

return bd.MODEL;

}

//android 获取当前手机品牌

public static String getPhoneProduct(Context context) {

Build bd = new Build();

return bd.PRODUCT;

}

//android 获取屏幕分辩率

public static String getMetrics(Context context) {

DisplayMetrics dm = new DisplayMetrics();

int h = dm.heightPixels;

int w = dm.widthPixels;

return h+ “*” +w;

}

//android获取当前时区

public static String getTimeZone(Context context) {

TimeZone tz = TimeZone.getDefault();

String s = tz.getID();

System.out.println(s);

return s;

}

//android获取当前日期时间

public static String getDateAndTime(Context context) {

SimpleDateFormat formatter = new SimpleDateFormat (“yyyy-MM-dd HH:mm:ss”);

Date curDate = new Date(System.currentTimeMillis());//获取当前时间

String str = formatter.format(curDate);

return str;

}

//获取手机系统语言 0中文简体 1其它

public static String getLanguage(Context context) {

Locale locale = context.getResources().getConfiguration().locale;

String language = locale.getLanguage();

if (language.endsWith(“zh”))

return “0”;

else

return “1”;

}

/**

  • 获取网络类型

*/

public static int getNetWorkType(Context context) {

ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo networkInfo = manager.getActiveNetworkInfo();

if (networkInfo != null && networkInfo.isConnected()) {

String type = networkInfo.getTypeName();

if (type.equalsIgnoreCase(“WIFI”)) {

return AVConstants.NETTYPE_WIFI;

} else if (type.equalsIgnoreCase(“MOBILE”)) {

NetworkInfo mobileInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

if (mobileInfo != null) {

switch (mobileInfo.getType()) {

case ConnectivityManager.TYPE_MOBILE:// 手机网络

switch (mobileInfo.getSubtype()) {

case TelephonyManager.NETWORK_TYPE_UMTS:

case TelephonyManager.NETWORK_TYPE_EVDO_0:

case TelephonyManager.NETWORK_TYPE_EVDO_A:

case TelephonyManager.NETWORK_TYPE_HSDPA:

case TelephonyManager.NETWORK_TYPE_HSUPA:

case TelephonyManager.NETWORK_TYPE_HSPA:

case TelephonyManager.NETWORK_TYPE_EVDO_B:

case TelephonyManager.NETWORK_TYPE_EHRPD:

case TelephonyManager.NETWORK_TYPE_HSPAP:

return AVConstants.NETTYPE_3G;

case TelephonyManager.NETWORK_TYPE_CDMA:

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

img

img

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

最后我还整理了很多Android中高级的PDF技术文档。以及一些大厂面试真题解析文档。

image

Android高级架构师之路很漫长,一起共勉吧!

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

713768551784)]

最后我还整理了很多Android中高级的PDF技术文档。以及一些大厂面试真题解析文档。

[外链图片转存中…(img-hLzgArod-1713768551785)]

Android高级架构师之路很漫长,一起共勉吧!

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值