package org.example.proyecto;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;

/**
 * Created by Victor on 17/09/2016.
 */
public class MyReceiver extends BroadcastReceiver  {

    AdaptadorCiudades adaptador =  MainActivity.adaptador;


    @Override
    public void onReceive(Context arg0, Intent arg1) {

        new MyNotificationTask(arg0).execute();

    }



    class MyNotificationTask extends AsyncTask<String, Void, Void> {

        public Context context;
        public Activity activity;

        public MyNotificationTask(Context arg0) {
            this.context = arg0;
            this.activity = MainActivity.activity;
        }

        @Override
        protected Void doInBackground(String... params) {

            if (adaptador.vectorCiudades == null || adaptador.vectorCiudades.size() == 0)
                adaptador.almacen.getVectorCiudades(adaptador);
            adaptador.recargarClima(activity,context,false);

            return null;
        }

    }

}