public static boolean sendData(Context c, Notification n, String packageName) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);

    ConnectivityManager connManager =
        (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

    // Check Wifi state, whether notifications are enabled globally, and
    // whether notifications are enabled for specific application
    if (prefs.getBoolean("pref_toggle", true)
        && prefs.getBoolean(packageName, true)
        && mWifi.isConnected()) {
      String ip = prefs.getString("pref_ip", "0.0.0.0:9090");

      // Magically extract text from notification
      ArrayList<String> notificationData = NotificationUtilities.getNotificationText(n);

      // Use PackageManager to get application name and icon
      final PackageManager pm = c.getPackageManager();
      ApplicationInfo ai;
      try {
        ai = pm.getApplicationInfo(packageName, 0);
      } catch (final NameNotFoundException e) {
        ai = null;
      }

      String notificationBody = "";
      String notificationHeader = "";
      // Create header and body of notification
      if (notificationData.size() > 0) {
        notificationHeader = notificationData.get(0);
        if (notificationData.size() > 1) {
          notificationBody = notificationData.get(1);
        }
      } else {
        return false;
      }

      for (int i = 2; i < notificationData.size(); i++) {
        notificationBody += "\n" + notificationData.get(i);
      }

      // Append application name to body
      if (pm.getApplicationLabel(ai) != null) {
        if (notificationBody.isEmpty()) {
          notificationBody = "via " + pm.getApplicationLabel(ai);
        } else {
          notificationBody += " (via " + pm.getApplicationLabel(ai) + ")";
        }
      }

      // Setup HTTP request
      MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

      // If the notification contains an icon, use it
      if (n.largeIcon != null) {
        entity.addPart(
            "notificon",
            new InputStreamBody(ImageUtilities.bitmapToInputStream(n.largeIcon), "drawable.png"));
      }
      // Otherwise, use the application's icon
      else {
        entity.addPart(
            "notificon",
            new InputStreamBody(
                ImageUtilities.bitmapToInputStream(
                    ImageUtilities.drawableToBitmap(pm.getApplicationIcon(ai))),
                "drawable.png"));
      }

      HttpPost post = new HttpPost("http://" + ip + "/notif");
      post.setEntity(entity);

      try {
        post.addHeader(
            "notifheader",
            Base64.encodeToString(
                notificationHeader.getBytes("UTF-8"), Base64.URL_SAFE | Base64.NO_WRAP));
        post.addHeader(
            "notifdescription",
            Base64.encodeToString(
                notificationBody.getBytes("UTF-8"), Base64.URL_SAFE | Base64.NO_WRAP));
      } catch (UnsupportedEncodingException e) {
        post.addHeader(
            "notifheader",
            Base64.encodeToString(notificationHeader.getBytes(), Base64.URL_SAFE | Base64.NO_WRAP));
        post.addHeader(
            "notifdescription",
            Base64.encodeToString(notificationBody.getBytes(), Base64.URL_SAFE | Base64.NO_WRAP));
      }

      // Send HTTP request
      HttpClient client = new DefaultHttpClient();
      HttpResponse response;
      try {
        response = client.execute(post);
        String html = EntityUtils.toString(response.getEntity());
        if (html.contains("true")) {
          return true;
        }
      } catch (ClientProtocolException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return false;
  }