简体   繁体   中英

Detect roaming on CDMA phones in android

In my app, I wanted to detect if phone is in roaming or not. I see that there is API in TelephonyManager

TelephonyManager telManager = (TelephonyManager)   context.getSystemService(Context.TELEPHONY_SERVICE);
telManager.isNetworkRoaming();

But the documentation here http://developer.android.com/reference/android/telephony/TelephonyManager.html#isNetworkRoaming%28%29 says " For GSM purpose". Does this mean this API will fail on CDMA network?

Thanks.

public class RoamingListener extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        TelephonyManager telephony =
            (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (telephony.isNetworkRoaming())
            Toast.makeText(context, "Is on TelephonyM Roaming", Toast.LENGTH_LONG).show();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM