Question

I need to create a program that would turn on 4G/WiMax (On an Evo 4G) off or on (based on current state).

I was digging around the API and noticed there is not a lot of mentioning of WiMax or 4G. I noticed: http://developer.android.com/reference/android/net/ConnectivityManager.html - but still I can't get WiMax to toggle on or off using the following code bit.

// get phone state
ConnectivityManager cm =
    (ConnectivityManager)getBaseContext().getSystemService(Context.CONNECTIVITY_SERVICE);

cm.startUsingNetworkFeature(cm.TYPE_WIMAX, "4g");

Thank you. I know this is possible i am just not sure how to do it.

Was it helpful?

Solution

For the next person to run into this problem heres the solution when it comes to MOST HTC phones that are wimax capable:

//make the object
Object wimaxManager = (Object)getBaseContext().getSystemService("wimax");

//declare the method
Method setWimaxEnabled = wimaxManager.getClass().getMethod("setWimaxEnabled", new Class[] { Boolean.TYPE });

//turn it on
setWimaxEnabled.invoke(wimaxManager, new Object[] { Boolean.TRUE });

//turn it off
setWimaxEnabled.invoke(wimaxManager, new Object[] { Boolean.FALSE });

There we go :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top