handleNotification

Handles the response to clicking a notification, looking up any associated data. This will open a deep link if present.

Note: This will return null if the notification is not handled by Flybuy.

A Flybuy notification will open the app’s main activity and provide information in the intent to let the app know it is a Flybuy notification. In onCreate() and onNewIntent() in the app’s main activity, call FlyBuyCore.handleNotification(it) so the SDK can handle the response, and return the metadata associated with the campaign.

Example:

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
handleIntent(intent)
}

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}

private fun handleIntent(intent: Intent?) {
intent?.let {
val notificationMetadata = FlyBuyCore.handleNotification(it)
if (null != notificationMetadata) {
// This is a Flybuy notification.
Toast.makeText(this, "Flybuy notification tapped: metadata = $metadata", Toast.LENGTH_LONG)
.show()
} else {
// Check other intents the app could receive.
}
}
}
}