Android: Force on Data Network if Wifi is on.Works on GSM fails CDMA Devices

402 Views Asked by At


On GSM devices able to force on data network if wifi is on ,But on CDMA devcies it fails.

public boolean isMobileHighPriorityUP() {
        ConnectivityManager connMgr = (ConnectivityManager) mCxt.getSystemService(Context.CONNECTIVITY_SERVICE);
        State mobileHigh = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_HIPRI).getState();
        Log.d(TAG, "--------- Network HIPRI State --------" + mobileHigh);
        if(mobileHigh == State.CONNECTED){
            return true;
        }
        return false;
    }


Above always return false on CDMA but on GSM true..
Found enableHIPRI here on Phone Interface firmware code.
Assuming Phonebase is used for GSM, and CDMAPhonebase is used for CDMA which extends PhoneBase.
Could not find much info on the firmware codes above and code1 code2.
Is CDMA firmware has some other design applied?Can you guys throw some light here.?
Thanks
NitZ

1

There are 1 best solutions below

1
On
int resultInt = connMgr.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableHIPRI");

Will return -1 if the device doesn't support HiPri; you have to fall back to forcing the 3g / 4g connection by turning off the wifi (and returning it to its previous state once you've finished).

Can't remember if all CDMA devices don't support HiPri, but it might be the device you're testing on?