Created
February 22, 2016 23:37
-
-
Save luizmarcus/dd3e41e3ad540b8d527a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventoReceiver extends BroadcastReceiver { | |
private EventBus bus = EventBus.getDefault(); | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
Evento evento = null; | |
if(intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)){ | |
evento=new Evento("Carregando!"); | |
} else if(intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED)){ | |
evento=new Evento("Não está carregando!"); | |
} | |
// Enviar o evento | |
bus.post(evento); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment