Guest User

Untitled

a guest
Jun 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. package org.grakovne.mds.android.service;
  2.  
  3. import android.content.Intent;
  4.  
  5. import org.grakovne.mds.android.common.ActionNames.Notification;
  6. import org.grakovne.mds.android.common.ExternalReceiver;
  7. import org.grakovne.mds.android.common.Receiver;
  8.  
  9. import static org.grakovne.mds.android.common.ActionNames.Player;
  10. import static org.grakovne.mds.android.manager.BroadcastManager.send;
  11.  
  12. public class GateService extends MdsService {
  13.  
  14. private Receiver receiver;
  15.  
  16. @Override
  17. protected void subscribe() {
  18. super.subscribe();
  19.  
  20. receiver = new ExternalReceiver(this,
  21. Player.PLAYED_INTENT,
  22. Player.PAUSED_INTENT,
  23. Notification.PRESSED_EVENT) {
  24.  
  25. @Override
  26. public void onAction(Intent intent, String action) {
  27. send(getContext(), action);
  28. }
  29. };
  30.  
  31. }
  32.  
  33. @Override
  34. protected void unsubscribe() {
  35. receiver.unsubscribe();
  36. super.unsubscribe();
  37. }
  38. }
Add Comment
Please, Sign In to add comment