Created
August 28, 2018 10:30
-
-
Save mariusz-blaszczak/75283dfff0e5ba20de2da37027168878 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
class AppMessagingService : FirebaseMessagingService() { | |
override fun onNewToken(token: String?) { | |
val registrationId = token ?: return | |
val userId = UUIDProvider.provide(this) // described later | |
// request push registration | |
} | |
override fun onMessageReceived(remoteMessage: RemoteMessage) { | |
super.onMessageReceived(remoteMessage) | |
Log.i(TAG, "Message received.") | |
AppCache.lockState = remoteMessage.getLockState() | |
LockWidgetProvider.showLockState(this) | |
} | |
private fun RemoteMessage.getLockState(): LockState? { | |
val json = data.get("state") ?: return null | |
return LockState.fromJson(json) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment