package com.qiyou.mb.android.receivers;

import com.qiyou.mb.android.QiYouConstant;
import com.qiyou.mb.android.service.OfflineMapService;
import com.qiyou.mb.android.utils.log.QLog;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class CoarseLocationReceiver extends BroadcastReceiver {
	public static String TAG ="com.qiyou.CoarseLocationReceiver"; 
    public static final String dTAG ="com.qiyou";
	public CoarseLocationReceiver() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		 
 
		    String key =null;		
//		    Location location =null;
		    String GEOAdressString =null; 
		    
		    key = QiYouConstant.EXTRA_KEY_OFFMAP;		
		    if (intent.hasExtra(key)) 
		    {
              QLog.getLogger().d(dTAG, TAG+ " offmap update... Network Coarse locaiton change Receiver got GEOAdressString ");
              QLog.getLogger().d(dTAG, TAG+ " offmap update... GEOAdressString: " + GEOAdressString);
               GEOAdressString = intent.getExtras().getString(key);
//		    	Log.e(TAG, "GPS time:" +Utils.getFormatedTime(location.getTime()));
		       Intent serviceIntent = new Intent(context, OfflineMapService.class); 
		       serviceIntent.putExtra(key, GEOAdressString);
		       context.startService(serviceIntent); 
		     
		    } 
		    
		  
		 /*   key = LocationManager.KEY_LOCATION_CHANGED;
		    if (intent.hasExtra(key)) 
		    {
               QLog.getLogger().d(dTAG, TAG+ " Network Coarse locaiton change Receiver got noticed ");
		       location = (Location)intent.getExtras().get(key);
		       
		       Intent serviceIntent = new Intent(context, OfflineMapService.class); 
		       serviceIntent.putExtra(key, GEOAdressString);
		       context.startService(serviceIntent); 
		    }*/
		    
          
		    
//		    Bundle extras = intent.getExtras();
		    
		  
	}

}
