title: How to get Context in an Intent Service
body: <p>Here's the scenario: I have a WakefulBroadcastReceiver that does a
  backup to a network computer or the cloud. It's set to go off in the
  middle of the night, when I know the tablet will have access to the
  LAN. The backup will store the data to a location and a file that was "picked" by the fragment that instantiated the WakefulBroadcastReceiver, 
  using the Storage Access Framework. So I need to be able to access the
  ContentResolver and to do that I need the context.</p>
  
  <p>From all my reading of the documents, this is what the
  BroadcastReceiver is meant to be used for - a potentially long running
  task that should be done in the background when not much else is
  happening. - Like a backup. I just haven't seen any examples that puts
  everything together.</p>
  
  <p>How do I get the context in an IntentService? Here
  is a snippet of the receiver and the scheduling service. </p>
  
  <pre><code>  public class BackupAlarmReceiver extends WakefulBroadcastReceiver {
  
      @Override
          public void onReceive(Context context, Intent intent) {
  
              Intent service = new Intent(context, BackupSchedulingService.class);
  
          startWakefulService(context, service);
  
          }
  }
  
  public class BackupSchedulingService extends IntentService {
      public BackupSchedulingService() {
          super("BackupSchedulingService");
      }
  
   @Override
      protected void onHandleIntent(Intent intent) {
  
          Bundle extras = intent.getExtras(); 
          // How to get the context - it was a parameter when
          // creating the new IntentService class above? 
           }
  }
  </code></pre>
  
  <p>The example code pretty much follows exactly the Android reference
  manual code here:</p>
  
  <p><a href="https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html" rel="noreferrer">https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html</a></p>