/**
 * 
 */
package com.qiyou.mb.android.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.qiyou.mb.android.QiYouConstant;
import com.qiyou.mb.android.service.LocationService;
import com.qiyou.mb.android.utils.Utils;
import com.qiyou.mb.android.utils.log.QLog;

/**
 * @author mwang
 *
 */
public class ForceUpdateReceiver extends BroadcastReceiver {

	public static String TAG ="com.qiyou.ForceUpdateReceiver"; 
    public static final String dTAG ="com.qiyou";
	  
	/**
	 * 
	 */
	public ForceUpdateReceiver() {
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
	 */
	@Override
	public void onReceive(Context context, Intent intent) { 
		    
		     String  key = QiYouConstant.EXTRA_KEY_FORCE_UPDATE;		    
		    if (intent.hasExtra(key)) {
		    //	Log.e(TAG, "Receiver got noticed, and sending to service.");
		    	boolean isForceUpdate = intent.getExtras().getBoolean(key); 
		    	 QLog.getLogger().dLog(TAG," AlarmManager time:" +Utils.getFormatedTime(System.currentTimeMillis()) +" ,"  + String.valueOf(isForceUpdate));
//		    	QLog.getLogger().d(dTAG, TAG+" "+"AlarmManager time:" +Utils.getFormatedTime(System.currentTimeMillis()) +" ,"  + String.valueOf(isForceUpdate))  ;
//		    	Log.e(TAG, "Hello AlarmManager, this is receiver, forwarding your request... " );
		    		
		       Intent serviceIntent = new Intent(context, LocationService.class); 
		       serviceIntent.putExtra(key, isForceUpdate);
		       context.startService(serviceIntent);  
		      
		    }
		 
		  
	}

}
