CANNOT get PhoneStateListener to work. I've seen the examples
<p>I need an application wide listener to determine when the service state changes on the phone. I've been through every example online, copied line for line, modified the manifest, and I CANNOT get anything to work.</p>

<p>Does a phone state listener HAVE to been in activity? Can I have some plain old class to listen for a phone state change?? </p>

<p>This is very frustrating.</p>

<p>In my class I have...</p>

<pre><code>     private class ServiceReceiver extends BroadcastReceiver{

        @Override
        public void onReceive(android.content.Context context, Intent intent) {

            Log.i(TAG, "onReceive");

            MyPhoneStateListener qpsl = new myPhoneStateListener();
            TelephonyManager tm = (TelephonyManager)context.getSystemService(android.content.Context.TELEPHONY_SERVICE);
            tm.listen(qpsl, PhoneStateListener.LISTEN_SERVICE_STATE);
        }
    }

    private class MyPhoneStateListener extends PhoneStateListener{

public void onServiceStateStateChanged(ServiceState serviceState){
    Log.i(TAG, "ServiceState = " + serviceState.getState();
}
</code></pre>

<p>I know I need to modify the manifest for the broadcast receiver and phonestate. Where? I want this application wide. </p>

<p>This is all the code I have, can someone show me what I'm missing so that I can listen for a service state change?</p>
