package com.consciencemobilesafe.receiver;

import com.consciencemobilesafe.service.UpdateWidgetService;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.sax.StartElementListener;
import android.util.Log;

public class MyWidget extends AppWidgetProvider {

	// ²»¹ÜÔõÃ´²Ù×÷£¬¶¼»áÖ´ÐÐÕâ¸ö·½·¨
	@Override
	public void onReceive(Context context, Intent intent) {
//		
		super.onReceive(context, intent);
	}

	// ¸üÐÂµÄÊ±ºò£¬Ö´ÐÐÕâ¸ö·½·¨£¬¸ù¾ÝÖ¸¶¨µÄÊ±¼ä½øÐÐË¢ÐÂ£¬×îÐ¡°ëÐ¡Ê±
	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager,
			int[] appWidgetIds) {
		Intent intent = new Intent(context, UpdateWidgetService.class);
		context.startService(intent);
		Log.d("", "´ò¿ªÁË");
		super.onUpdate(context, appWidgetManager, appWidgetIds);
	}

	// µÚÒ»´Î´´½¨µÄÊ±ºò£¨ÆÁÄ»ÉÏÃæÃ»ÓÐÕâ¸öwidget£©
	public void onEnabled(Context context) {
		Intent intent = new Intent(context, UpdateWidgetService.class);
		context.startService(intent);
		Log.d("", "µÚÒ»´Î");

		super.onEnabled(context);
	}

	// µ±È«²¿µÄwidgetÏûÊ§µÄÊ±ºòµ÷ÓÃ
	public void onDisabled(Context context) {
		Intent intent = new Intent(context, UpdateWidgetService.class);
		context.stopService(intent);
		super.onDisabled(context);
	
	}

}
