Trouble starting a PhoneStateListener from an ON_BOOT_COMPLETED Broadcast Receiver
<p>I am trying to restart a PhoneStateListener after the phone has been rebooted (if my isRunning SharedPref is true... i.e. the listener was running before the reboot)</p>

<p>Here is my code... </p>

<p>Eclipse gives me an error on the line: final TelephonyManager telephonyManager = (TelephonyManager)getSystemService(srvcName);</p>

<p>It says that getSystemService(String) is not defined. Anyone know why? The same basic code works just fine in my main app activity.</p>

<pre><code>public class MyReceiver extends BroadcastReceiver {
    SharedPreferences mPrefs;

    String srvcName = Context.TELEPHONY_SERVICE;
    final TelephonyManager telephonyManager = (TelephonyManager)getSystemService(srvcName); 

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


        mPrefs = context.getSharedPreferences("myAppPrefs", 0); 
        if(getRunning()){
             telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
        }

      }
</code></pre>
