Plugin to Plugin
Your ATAK plugin can send and receive data over Somewear via the Somewear ATAK Plugin.
Messages
Outbound
A third party plugin can send a workspace message through the Somewear plugin by broadcasting an intent.
Intent intent = new Intent("com.somewearlabs.tak.message.SEND");
intent.putExtra("content", "Test outbound message");
intent.putExtra("parcelId", 123);
AtakBroadcast.getInstance().sendBroadcast(intent);Outbound Status
Outbound data and message payloads transmissions will be retried until success or a timeout occurs. You can observe terminal status changes with intents.
public static final String SOMEWEAR_MESSAGE_OUTBOUND = "com.somewearlabs.tak.message.OUTBOUND";
override fun onReceive(context: Context, intent: Intent) {
switch (action) {
case HelloWorldDropDownReceiver.SOMEWEAR_MESSAGE_OUTBOUND: {
String status = intent.getStringExtra("status");
int parcelId = intent.getIntExtra("parcelId", 0);
if (status.equals("Delivered")) {
Log.d(TAG, "onReceive: did send Somewear message; parcelId=" + parcelId);
} else if (status.equals("Error") {
Log.d(TAG, "onReceive: Somewear message did timeout; parcelId=" + parcelId);
}
break;
}
}
}Inbound
A third party plugin can listen for inbound workspace messages as well.
During development, this must first be enabled in the Somewear plugin debug menu. To show the debug menu go to Settings > Long press on Send Logs. Then toggle Broadcast inbound messages.
Once the debug option is enabled, you can listen for inbound messages by registering a BroadcastReceiver. Your plugin’s DropDownReceiver implements BroadcastReceiver already. Here’s a modified version of the helloworld sample:
Data
You can send/receive generic data payloads as well.
Outbound
Inbound
Unlike inbound message payloads, you don’t have to change any settings in the Somewear plugin to listen for data payloads.
Last updated