Broadcast Receiver
The business app needs to implement a broadcast receiver that filters the following actions
com.swedbankpay.payment.intent.ECR_NEXO_MESSAGE
com.swedbankpay.payment.intent.ECR_ADMIN
Whenever these are received the business app should place itself on top. For ECR_NEXO_MESSAGE
the actual SaleToPOIResponse\Request
is placed in the property extras
of the intent.
what it could look like if using kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
@Inject
lateinit var nexoHandler: NexoHandler
override fun onReceive(
context: Context,
intent: Intent,
) {
AndroidInjection.inject(this, context)
moveToForground(context);
val nexoMessage = requireNotNull(intent.extras?.getByteArray(Intent.EXTRA_TEXT))
nexoHandler.handle(nexoMessage)
}
private fun moveToForeground(context: Context) {
Intent(context, MainActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
}.also { context.startActivity(it) }
}
}