Android 判斷SIM卡屬于哪個移動運營商的實現(xiàn)代碼
更新時間:2013年05月20日 12:55:47 作者:
有時候我們需要在Android中獲取本機網(wǎng)絡(luò)提供商呢,這里簡單分享下,方便需要的朋友
復(fù)制代碼 代碼如下:
[java]
public String getProvidersName()
{
String str = "N/A";
try
{
this.IMSI = this.telephonyManager.getSubscriberId();
System.out.println(this.IMSI);
if (this.IMSI.startsWith("46000"))
str = "中國移動"; break;
if (this.IMSI.startsWith("46002"))
str = "中國移動"; break ;
if (this.IMSI.startsWith("46001"))
str = "中國聯(lián)通";
else if (this.IMSI.startsWith("46003"))
str = "中國電信";
}
catch (Exception localException)
{
localException.printStackTrace();
}
return str;
}
注意申明:
[java]
復(fù)制代碼 代碼如下:
this.telephonyManager = ((TelephonyManager)paramContext.getSystemService("phone"));
就這么簡單。。。。
相關(guān)文章
圖文講解Android的ImageView類中的ScaleType屬性設(shè)置
這篇文章主要介紹了Android的ImageView類中的ScaleType屬性設(shè)置,同時文中還講了實現(xiàn)圖片寬度100%ImageView寬度且高度按比例自動伸縮的方法,需要的朋友可以參考下2016-03-03Android自定義軟鍵盤的設(shè)計與實現(xiàn)代碼
本篇文章主要介紹了 Android自定義軟鍵盤的設(shè)計與實現(xiàn)代碼,有需要的可以了解一下。2016-11-11Android日期選擇器實現(xiàn)年月日三級聯(lián)動
這篇文章主要為大家詳細介紹了Android日期選擇器實現(xiàn)年月日三級聯(lián)動,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-01-01Android獲得設(shè)備狀態(tài)信息、Mac地址、IP地址的方法
今天小編就為大家分享一篇關(guān)于Android獲得設(shè)備狀態(tài)信息、Mac地址、IP地址的方法,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2018-12-12