Advertisement
vitareinforce

Workground di Main Activity

Apr 10th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // Sebelum on create
  2. RMQ rmq = new RMQ();
  3. private Thread subscribeThread;
  4.  
  5. // Di On Create Tambahkan ini
  6. rmq.setupConnectionFactory();
  7. subscribeNotification();
  8.  
  9. /**
  10. * Function for subscribe data from RMQ, for receiving callback
  11. * Buat fungsi baru di luar on create dkk
  12. */
  13. private void subscribeNotification() {
  14. final Handler incomingMessageHandler = new Handler() {
  15. @Override
  16. public void handleMessage(Message msg) {
  17. String title = "Pengumuman";
  18. String message = msg.getData().getString("msg");
  19. Log.d("RMQMessage", message);
  20.  
  21. showNotification(title, message);
  22. }
  23. };
  24. rmq.subscribeNotification(incomingMessageHandler,subscribeThread);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement