離線根據手機號獲取運營商及城市省份資訊

2021-10-01 11:12:03 字數 1190 閱讀 3094

/*** 根據國家**和手機號 判斷手機號是否有效

* 中國的**是86,判斷標準是通過封裝的類phonenumberutil.getinstance()獲取判斷物件

* @param phonenumber

* @param countrycode

* @return

*/public static boolean checkphonenumber(string phonenumber, string countrycode)

int ccode = integer.valueof(countrycode);

long phone = long.valueof(phonenumber);

phonenumber.phonenumber pn = new phonenumber.phonenumber();

pn.setcountrycode(ccode);

pn.setnationalnumber(phone);

//返回結果只有英文,自己轉成成中文

string carrierzh = "";

carrierzh += geocoder.getdescriptionfornumber(pn, locale.chinese);

switch (carrieren)

return carrierzh;

}

/**

** @description: 根據國家**(86)和手機號 獲取手機歸屬地

* @param @param phonenumber

* @param @param countrycode

* @param @return 引數

* @throws

*/public static string getgeo(string phonenumber, string countrycode)

com.googlecode.libphonenumber

libphonenumber

8.7.1

com.googlecode.libphonenumber

geocoder

2.76

com.googlecode.libphonenumber

carrier

1.66

手機號段運營商歸屬介紹

2008年10月1日後 現階段 號段分配情況如下 由於中國電信業重組,2008年10月1日起中國聯通cdma網路正式 給中國電信,重組後已經發出三張3g通訊牌照,新的號段分配情況如下 中國移動 全球通 神州行 動感地帶 中國移動3g品牌 g3 gsm td scdma 134 135 136 137...

通過解析手機號,得到歸屬地和運營商

在工作中需要自定義乙個udf類,在hive中對手機號解析,得到手機號的歸屬地和運營商.在網上查詢許久,有的api已經過時有的需要申請註冊並且還有次數等一些限制,最終選定了某度的免費api mobilenumber 目前還沒遇到次數限制也不需要過多的其他條件,只需要通過對api返回的json結果進行分...

Android手機中獲取手機號碼和運營商資訊

如下 package com.pei.activity import android.os.bundle import android.view.view import android.view.view.onclicklistener import android.widget.button im...