Android Broadcast

You can have your prototype interact with other Android apps by using Android Broadcasts by selecting Android Broadcast Android Broadcast as a channel in the Send responses and Receive triggers.

To send a message to your prototype from your Android app, send a broadcast using Intent with theio.protopie.action.ONE_TIME_TRIGGER action.

val intent = Intent("io.protopie.action.ONE_TIME_TRIGGER")
intent.putExtra("messageId", "YOUR_MESSAGE_ID")
intent.putExtra("value", "123") // Optional

To receive messages from your prototype, register a BroadcastReceiver with an IntentFilter for the  io.protopie.action.ONE_TIME_RESPONSE   action.

val receiver = object : BroadcastReceiver() {
  override fun onReceive(context: Context, intent: Intent) {
    val messageId = intent.getStringExtra("messageId")
    val value = intent.getStringExtra("value")
    println("Message from ProtoPie. messageId=$messageId value=$value")

val filter = IntentFilter("io.protopie.action.ONE_TIME_RESPONSE")
context.registerReceiver(receiver, filter)