How does Android obtain the local network provider? See the following code:
[Java]
Public String getProvidersName ()
{
String str = "N/";
Try
{
This. IMSI = this. telephonyManager. getSubscriberId ();
System. out. println (this. IMSI );
If (this. IMSI. startsWith ("46000 "))
Str = "China Mobile"; break;
If (this. IMSI. startsWith ("46002 "))
Str = "China Mobile"; break;
If (this. IMSI. startsWith ("46001 "))
Str = "China Unicom ";
Else if (this. IMSI. startsWith ("46003 "))
Str = "China Telecom ";
}
Catch (Exception localException)
{
LocalException. printStackTrace ();
}
Return str;
}
Public String getProvidersName ()
{
String str = "N/";
Try
{
This. IMSI = this. telephonyManager. getSubscriberId ();
System. out. println (this. IMSI );
If (this. IMSI. startsWith ("46000 "))
Str = "China Mobile"; break;
If (this. IMSI. startsWith ("46002 "))
Str = "China Mobile"; break;
If (this. IMSI. startsWith ("46001 "))
Str = "China Unicom ";
Else if (this. IMSI. startsWith ("46003 "))
Str = "China Telecom ";
}
Catch (Exception localException)
{
LocalException. printStackTrace ();
}
Return str;
} Note:
[Java]
This. telephonyManager = (TelephonyManager) paramContext. getSystemService ("phone "));
This. telephonyManager = (TelephonyManager) paramContext. getSystemService ("phone "));
That's simple ....