public override void OnReceive(Context context, Intent intent) { if (intent.Action == Intent.ActionScreenOn) { WidgetUpdateService.Start(context); } else if (intent.Action == Intent.ActionScreenOff) { WidgetUpdateService.Stop(context); } }
public override void OnDisabled(Context context) { ComponentName widgetComponent = GetComponentName(context); AppWidgetManager appWidgetManager = AppWidgetManager.GetInstance(context); int[] appWidgetIds = appWidgetManager.GetAppWidgetIds(widgetComponent); if (appWidgetIds.Length == 0 && TramUrWayApplication.Config.EnableWidgetRefresh) { WidgetUpdateService.Stop(context); } }