Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.89 KB | None | 0 0
  1. override fun onMessageReceived(message: RemoteMessage) {
  2.  
  3.         (applicationContext as App).appComponent.inject(this)
  4.  
  5.  
  6.         val shipmentNumber = message.data["shipment_number"]
  7.  
  8.         val notificationMessage = message.data["body"]
  9.  
  10.         val title = message.data["title"]
  11.  
  12.         if (shipmentNumber != null) {
  13.  
  14.             disposable += workManagerShipmentService.downloadShipmentAndRestartGeofencing(shipmentNumber) // metoda zwraca completable, jej błąd jest mało prawdopodobny, gdyby jednak wystapił mielibyśmy zalogowane crash z tego miejsca, jednak żadnego nie mamy
  15.  
  16.                 .subscribe {
  17.  
  18.                     val id = System.currentTimeMillis().toInt()
  19.  
  20.                     showNotification(applicationContext, id, title, notificationMessage, createNotificationShipmentPendingIntent(applicationContext, id, shipmentNumber))
  21.  
  22.                 }
  23.  
  24.         }
  25.  
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement