Last active
August 17, 2020 13:32
-
-
Save scottyab/90a92c0e753c41cef105bc2b65e581d6 to your computer and use it in GitHub Desktop.
Sample of how an app "MyApp" would intergrate and enable Beacon SDK push notifications
This file contains 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 MyAppFirebaseMessagingService : FirebaseMessagingService() { | |
override fun onMessageReceived(remoteMessage: RemoteMessage) { | |
if(remoteMessage.data.isNotEmpty()) { | |
processNewMessage(remoteMessage.data) | |
} | |
} | |
private fun processNewMessage(remoteMessageData: Map<String, String>) { | |
if (BeaconPushNotificationsProcessor.isBeaconNotification(remoteMessageData)) { | |
val beaconPushProcessor = BeaconPushNotificationsProcessor() | |
beaconPushProcessor.process(this, remoteMessageData) | |
} else { | |
processMyAppNotification(remoteMessageData) | |
} | |
} | |
override fun onNewToken(token: String) { | |
Beacon.setFirebaseCloudMessagingToken(token) | |
storeAndUploadTokenToMyAppServer(token) | |
} | |
private fun processMyAppNotification(remoteMessageData: Map<String, String>) { | |
TODO("Not yet implemented") | |
} | |
private fun storeAndUploadTokenToMyAppServer(token: String) { | |
TODO("Not yet implemented") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment