title: Cannot getApplicationContext() from BroadcastReceiver
body: <p>My Application is asking me to create a method for getResources() or getApplicationContext().</p>
  
  <p>Are these methods not allowed to be called in a BroadcastReceiver?</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent arg1) {
      createNotification(Calendar.getInstance().getTimeInMillis());
  }
  
     public void createNotification(long when) {
  
          Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(),
                  R.drawable.stamptwo);
          int smalIcon = R.drawable.stamptwoxhdpi;
  
          Intent intent = new Intent(context.getApplicationContext(),
                  Lockscreen.class);
          intent.putExtra(NOTIFICATION_DATA, notificationData);
          intent.setData(Uri.parse("content://" + when));
          PendingIntent pendingIntent = PendingIntent.getActivity(
                  context.getApplicationContext(), 0, intent,
                  Intent.FLAG_ACTIVITY_NEW_TASK);
  
          NotificationManager notificationManager = (NotificationManager) context
                  .getApplicationContext().getSystemService(
                          Context.NOTIFICATION_SERVICE);
  
          NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
                  context.getApplicationContext())
                  .setWhen(when)
                  .setContentText(notificationContent)
                  .setContentTitle(notificationTitle)
                  .setSmallIcon(smalIcon)
                  .setAutoCancel(true)
                  .setTicker(notificationTitle)
                  .setLargeIcon(largeIcon)
                  .setDefaults(
                          Notification.DEFAULT_LIGHTS
                                  | Notification.DEFAULT_VIBRATE
                                  | Notification.DEFAULT_SOUND)
                  .setContentIntent(pendingIntent);
  
          Notification notification = notificationBuilder.build();
  
          notificationManager.notify((int) when, notification);
      }
      }
  </code></pre>