title: How to get Data from an activity periodically?
body: <p>I am trying to make a dashclock extension for my app. Basically my app's main activity reads data from the sensor and shows it. Now the dashclock extends DashClockExntension which extends Service. My doubt is, how should i make this service to ask data from the app's main class. If i am using an intent with startService(), then I am getting null values in the widget. How to get that data right before the widget displays it.</p>
  
  <pre><code>package com.thePaze.Ambiance;
  
  import android.content.Intent;
  import com.google.android.apps.dashclock.api.DashClockExtension;
  import com.google.android.apps.dashclock.api.ExtensionData;
  
  public class DashMain extends DashClockExtension {
  
      String temp, humidity;
  
      @Override
      protected void onUpdateData(int reason) {
          // TODO Auto-generated method stub
  
  
  
          publishUpdate(new ExtensionData().visible(true).status("Ambient").icon(R.drawable.ic_launcher).expandedTitle("Temp &amp; Humidity").expandedBody("Temperature: " + temp+ "\nHumidity: " +humidity)
                  .clickIntent(new Intent(DashMain.this, SensorMain.class))
  
          );
  
      }
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          // TODO Auto-generated method stub
          super.onStartCommand(intent, flags, startId);
  
          temp = intent.getStringExtra(temp);
          humidity = intent.getStringExtra(humidity); 
  
  
          return START_STICKY;
  
      }
  
  }   
  </code></pre>