How do I get a reference to ConnectivityService object?
<p>I've tried everything I can think of. I tried to call getInstance(), but the class wasn't in my SDK.</p>

<pre><code>ConnectivityService cs = ConnectivityService.getInstance(this);
</code></pre>

<p>I tried using reflection to do the above, </p>

<pre><code>Class csClass = Class.forName("com.android.server.ConnectivityService");
Method getInstanceMethod = csClass.getDeclaredMethod("getInstance", Context.class);
Object cs = getInstanceMethod.invoke(null, this); // this = Context
</code></pre>

<p>but it gave a security exception saying I needed WRITE_SECURE_SETTINGS permissions, but those permissions are only available to manufacturers. </p>

<p>I tried to get it via ServiceManager, but it only returned an android.os.BinderProxy class.</p>

<pre><code>IBinder cs = ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
Log.d("HelloWorld", "cs.class:"+cs.getClass());
</code></pre>

<p>Finally, I tried to access the static field in ConnectivityService which holds an instance of itself, but it was null.</p>

<pre><code>Class csClass = Class.forName("com.android.server.ConnectivityService");
for (Field f : csClass.getDeclaredFields()) {
    f.setAccessible(true);
    if (Modifier.isStatic(f.getModifiers())) {
        Log.d("HelloWorld", "ConnectivityServiceExt."+f.getName() + ": " + f.get(null));
    }
}
Field sServiceInstanceField = csClass.getDeclaredField("sServiceInstance");
sServiceInstanceField.setAccessible(true); // private
Object cs = sServiceInstanceField.get(null); // ConnectivityService object
</code></pre>

<p>I even tried to access ConnectivityServiceExt.sServiceInstance, but that was also null too.</p>

<p>Once I get a hold of it, I want to try additional calls on ConnectivityService using reflection to turn the radios on.</p>
