次のコードを使用して、デバイスが使用しているネットワークを確立しています。
TelephonyManager tempManager;
tempManager= (TelephonyManager)myContext.getSystemService(Context.TELEPHONY_SERVICE);
int result = 0;
if(tempManager != null && tempManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS) //do we have a UMTS connection ?
{
result = 2;
}
else if(tempManager != null && tempManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_GPRS) //or is it just a shabby 2g connection ?
{
result = 1;
}
else if(tempManager != null && tempManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UNKNOWN) //or is it just a shabby 2g connection ?
{
result = 4;
}
return result;
HSDPA接続に接続しない限り、かなりうまく機能します。その場合、結果として常に0が返されます。私の場合、ソフトウェアは接続がまったくないと考えます:(
何が起こっているのかを知っていて、これに関する経験があり、最も重要なことに、この問題の解決策を持っている人は誰でも???
前もって感謝します