예제 #1
0
 private void sendBroadcast(WeatherInfo w) {
   Intent broadcast = new Intent(INTENT_WEATHER_UPDATE);
   w.timestamp = Helpers.getTimestamp(getApplicationContext());
   try {
     broadcast.putExtra(EXTRA_CITY, w.city);
     broadcast.putExtra(EXTRA_CONDITION, w.condition);
     broadcast.putExtra(EXTRA_LAST_UPDATE, w.timestamp);
     broadcast.putExtra(EXTRA_CONDITION_CODE, w.condition_code);
     broadcast.putExtra(EXTRA_FORECAST_DATE, w.forecast_date);
     broadcast.putExtra(EXTRA_HUMIDITY, w.humidity);
     broadcast.putExtra(EXTRA_TEMP, w.temp);
     broadcast.putExtra(EXTRA_WIND, w.wind);
     broadcast.putExtra(EXTRA_LOW, w.low);
     broadcast.putExtra(EXTRA_HIGH, w.high);
   } catch (Exception e) {
     e.printStackTrace();
   }
   getApplicationContext().sendBroadcast(broadcast);
 }