com.google.android.gms.wearable.MessageEvent Java Examples

The following examples show how to use com.google.android.gms.wearable.MessageEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageReceiverService.java    From ibm-wearables-android-sdk with Apache License 2.0 6 votes vote down vote up
/**
 * Handle messages from the phone
 * @param messageEvent new message from the phone
 */
@Override
public void onMessageReceived(MessageEvent messageEvent) {

    if (messageEvent.getPath().equals("/start")) {
        dataManager.turnSensorOn(Integer.valueOf(new String(messageEvent.getData())));
    }

    else if (messageEvent.getPath().equals("/stop")){
        dataManager.turnSensorOff(Integer.valueOf(new String(messageEvent.getData())));
    }

    else if (messageEvent.getPath().equals("/stopAll")){
        dataManager.turnAllSensorsOff();
    }

    else if (messageEvent.getPath().equals("/ping")){
        NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(apiClient).await();
        for(Node node : nodes.getNodes()) {
            Wearable.MessageApi.sendMessage(apiClient, node.getId(), "/connected", null).await();
        }
    }
}
 
Example #2
Source File: IncomingRequestPhoneService.java    From wear-os-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    super.onMessageReceived(messageEvent);
    Log.d(TAG, "onMessageReceived(): " + messageEvent);

    String messagePath = messageEvent.getPath();

    if (messagePath.equals(Constants.MESSAGE_PATH_PHONE)) {

        DataMap dataMap = DataMap.fromByteArray(messageEvent.getData());
        int requestType = dataMap.getInt(Constants.KEY_COMM_TYPE, 0);

        if (requestType == Constants.COMM_TYPE_REQUEST_PROMPT_PERMISSION) {
            promptUserForStoragePermission(messageEvent.getSourceNodeId());

        } else if (requestType == Constants.COMM_TYPE_REQUEST_DATA) {
            respondWithStorageInformation(messageEvent.getSourceNodeId());
        }
    }
}
 
Example #3
Source File: IncomingRequestWearService.java    From wear-os-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    Log.d(TAG, "onMessageReceived(): " + messageEvent);

    String messagePath = messageEvent.getPath();

    if (messagePath.equals(Constants.MESSAGE_PATH_WEAR)) {
        DataMap dataMap = DataMap.fromByteArray(messageEvent.getData());

        int requestType = dataMap.getInt(Constants.KEY_COMM_TYPE);

        if (requestType == Constants.COMM_TYPE_REQUEST_PROMPT_PERMISSION) {
            promptUserForSensorPermission();

        } else if (requestType == Constants.COMM_TYPE_REQUEST_DATA) {
            respondWithSensorInformation();
        }
    }
}
 
Example #4
Source File: WearService.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    //This method will call while any message is posted by the watch to the phone.
    //This is message api, so if the phone is not connected message will be lost.
    //No guarantee of the message delivery

    //check path of the message
    if (messageEvent.getPath().equalsIgnoreCase(STEP_COUNT_MESSAGES_PATH)) {

        //Extract the values
        String stepCount = new String(messageEvent.getData());
        Log.d("Step count: ", stepCount + " ");

        //send broadcast to update the UI in MainActivity based on the tracking status
        Intent intent = new Intent(TRACKING_COUNT_ACTION);
        intent.putExtra("step-count", stepCount);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
    } else {
        super.onMessageReceived(messageEvent);
    }
}
 
Example #5
Source File: ListenerService.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {

    if (messageEvent.getPath().equals("/message_path")) {
        final String message = new String(messageEvent.getData());
        Log.v(TAG, "Message path received on phone is: " + messageEvent.getPath());
        Log.v(TAG, "Message received on phone is: " + message);

        // Broadcast message to MainActivity for display
        Intent messageIntent = new Intent();
        messageIntent.setAction(Intent.ACTION_SEND);
        messageIntent.putExtra("message", message);
        LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
    }
    else {
        super.onMessageReceived(messageEvent);
    }
}
 
Example #6
Source File: ListenerService.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {

    if (messageEvent.getPath().equals("/message_path")) {
        final String message = new String(messageEvent.getData());
        Log.v(TAG, "Message path received is: " + messageEvent.getPath());
        Log.v(TAG, "Message received is: " + message);

        // Broadcast message to wearable activity for display
        Intent messageIntent = new Intent();
        messageIntent.setAction(Intent.ACTION_SEND);
        messageIntent.putExtra("message", message);
        LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
    }
    else {
        super.onMessageReceived(messageEvent);
    }
}
 
Example #7
Source File: PlayNetwork.java    From CrossBow with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    if(messageEvent.getPath().contains("crossbow_wear")) {
        byte[] data = messageEvent.getData();
        Log.d("Play Network", "request response returned");
        try {
            WearNetworkResponse wearNetworkResponse = WearNetworkResponse.fromByteArray(data);
            String uuid = wearNetworkResponse.uuid;
            responsesMap.put(uuid, wearNetworkResponse);

            if(latchMap.containsKey(uuid)) {
                //unlatch the correct thread
                Log.d("Play Network", "unlatching thread");
                latchMap.get(uuid).countDown();
            }
        }
        catch (Exception e) {
            Log.d("Play Network", "wearNetworkResponse error = " + e);
        }
        Log.d("Play Network", "request response returned");
    }
}
 
Example #8
Source File: WearService.java    From ETSMobile-Android2 with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {

    if (messageEvent.getPath().equals("/today_req")) {

        final String message = new String(messageEvent.getData());

        List<Seances> seances = new ArrayList<>();

        DatabaseHelper databaseHelper = new DatabaseHelper(this);
        SimpleDateFormat seancesFormatter = new SimpleDateFormat("yyyy-MM-dd", getResources().getConfiguration().locale);

        try {
            seances = databaseHelper.getDao(Seances.class).queryBuilder()
                    .where()
                    .like("dateDebut", seancesFormatter.format(DateTime.now().toDate()) + "%")
                    .query();
            Collections.sort(seances, new SeanceComparator());
        } catch (SQLException e) {
            e.printStackTrace();
        }

        new SendToDataLayerThread("/today_req", seances, this).start();

    }
}
 
Example #9
Source File: ListenerService.java    From AnkiDroid-Wear with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
        final String message = new String(messageEvent.getData());
        Log.v("myTag", "Message path received on watch is: " + messageEvent.getPath());
        Log.v("myTag", "Message received on watch is: " + message);

        Intent messageIntent = new Intent();
        messageIntent.setAction(Intent.ACTION_SEND);
        messageIntent.putExtra("path", messageEvent.getPath());
        messageIntent.putExtra("message", new String(messageEvent.getData()));
        LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);


        super.onMessageReceived(messageEvent);

}
 
Example #10
Source File: WearMessageListener.java    From watchpresenter with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    if (Log.isLoggable(Constants.LOG_TAG, Log.DEBUG)) {
        Log.d(Constants.LOG_TAG, "onDataChanged: " + messageEvent);
    }

    final String messagePath = messageEvent.getPath();
    if(messagePath != null){
        if(messagePath.equals(Constants.NEXT_SLIDE_GESTURE_DETECTED_PATH)) {
            Log.d(Constants.LOG_TAG, "Next slide message received from Wear device...");
            Intent intent = new Intent(SendMessageReceiver.INTENT);
            intent.putExtra(Constants.EXTRA_MESSAGE, Constants.NEXT_SLIDE_MESSAGE);
            sendBroadcast(intent);
        }
        else{
            Log.i(Constants.LOG_TAG, "Received message with unknown path: " + messagePath);
        }
    }
    else{
        Log.e(Constants.LOG_TAG, "Message with null path: " + messageEvent);
    }
}
 
Example #11
Source File: MainActivity.java    From wearable with Apache License 2.0 6 votes vote down vote up
/**
 *  The listener is in the code, in this example (instead in a separate listener).
 *  note, the listener is removed when the activity is paused.
 */
@Override
public void onMessageReceived(@NonNull MessageEvent messageEvent) {
    Log.d(TAG, "onMessageReceived() A message from watch was received:"
        + messageEvent.getRequestId() + " " + messageEvent.getPath());
    if (messageEvent.getPath().equals("/message_path")) {  //don't think this if is necessary anymore.
        String message =new String(messageEvent.getData());
        Log.v(TAG, "Wear activity received message: " + message);
        // Display message in UI
        mTextView.setText(message);
        //here, send a message back.
        message = "Hello device " + num;
        //Requires a new thread to avoid blocking the UI
        new SendThread(datapath, message).start();
        num++;
    }
}
 
Example #12
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (messageEvent.getPath().equals(TIMER_SELECTED_PATH)) {
                Toast.makeText(getApplicationContext(), R.string.toast_timer_selected,
                        Toast.LENGTH_SHORT).show();
            } else if (messageEvent.getPath().equals(TIMER_FINISHED_PATH)) {
                Toast.makeText(getApplicationContext(), R.string.toast_timer_finished,
                        Toast.LENGTH_SHORT).show();
            }
        }
    });

}
 
Example #13
Source File: WatchFaceConfigListenerService.java    From american-sunsets-watch-face with Apache License 2.0 5 votes vote down vote up
@Override // WearableListenerService
public void onMessageReceived(MessageEvent messageEvent) {
    if (!messageEvent.getPath().equals(SunsetsWatchFaceUtil.PATH_WITH_FEATURE)) {
        return;
    }
    byte[] rawData = messageEvent.getData();
    // It's allowed that the message carries only some of the keys used in the config DataItem
    // and skips the ones that we don't want to change.
    DataMap configKeysToOverwrite = DataMap.fromByteArray(rawData);
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Received watch face config message: " + configKeysToOverwrite);
    }

    if (mGoogleApiClient == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this).addApi(Wearable.API).build();
    }
    if (!mGoogleApiClient.isConnected()) {
        ConnectionResult connectionResult =
                mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS);

        if (!connectionResult.isSuccess()) {
            Log.e(TAG, "Failed to connect to GoogleApiClient.");
            return;
        }
    }

    SunsetsWatchFaceUtil.overwriteKeysInConfigDataMap(mGoogleApiClient, configKeysToOverwrite);
}
 
Example #14
Source File: ListenerService.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    Log.v(TAG, "onMessageReceived: " + messageEvent);

    if (Constants.CLEAR_NOTIFICATIONS_PATH.equals(messageEvent.getPath())) {
        // Clear the local notification
        UtilityService.clearNotification(this);
    }
}
 
Example #15
Source File: MainWearableListenerService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
	switch (messageEvent.getPath()) {
		case Constants.ACTION_DISCONNECT: {
			// A disconnect message was sent. The information which profile should be disconnected is in the data.
			final String profile = new String(messageEvent.getData());

			//noinspection SwitchStatementWithTooFewBranches
			switch (profile) {
				// Currently only UART profile has Wear support
				case Constants.UART.PROFILE: {
					final Intent disconnectIntent = new Intent(UARTService.ACTION_DISCONNECT);
					disconnectIntent.putExtra(UARTService.EXTRA_SOURCE, UARTService.SOURCE_WEARABLE);
					sendBroadcast(disconnectIntent);
					break;
				}
			}
			break;
		}
		case Constants.UART.COMMAND: {
			final String command = new String(messageEvent.getData());

			final Intent intent = new Intent(UARTService.ACTION_SEND);
			intent.putExtra(UARTService.EXTRA_SOURCE, UARTService.SOURCE_WEARABLE);
			intent.putExtra(Intent.EXTRA_TEXT, command);
			sendBroadcast(intent);
		}
		default:
			super.onMessageReceived(messageEvent);
			break;
	}
}
 
Example #16
Source File: MainWearableListenerService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
	final String message = new String(messageEvent.getData());

	switch (messageEvent.getPath()) {
		case Constants.UART.DEVICE_CONNECTED: {
			// Disconnect action
			final Intent disconnectIntent = new Intent(ActionReceiver.ACTION_DISCONNECT);
			disconnectIntent.putExtra(ActionReceiver.EXTRA_DATA, Constants.UART.PROFILE);
			final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, UART_DISCONNECT, disconnectIntent, PendingIntent.FLAG_CANCEL_CURRENT);

			// Open action
			final Intent intent = new Intent(this, UARTConfigurationsActivity.class);
			final PendingIntent pendingIntent = PendingIntent.getActivity(this, UART_SHOW_CONFIGURATIONS, intent, PendingIntent.FLAG_UPDATE_CURRENT);

			final NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
					.setContentIntent(pendingIntent)
					.setOngoing(true)
					.setSmallIcon(R.mipmap.ic_launcher)
					.setContentTitle(getString(R.string.notif_uart_device_connected))
					.setContentText(message)
					.addAction(new NotificationCompat.Action(R.drawable.ic_full_bluetooth, getString(R.string.action_disconnect), disconnectAction))
					.setLocalOnly(true);
			NotificationManagerCompat.from(this).notify(UART_NOTIFICATION_ID, builder.build());
			break;
		}
		case Constants.UART.DEVICE_LINKLOSS:
		case Constants.UART.DEVICE_DISCONNECTED: {
			NotificationManagerCompat.from(this).cancel(UART_NOTIFICATION_ID);
		}
		default:
			super.onMessageReceived(messageEvent);
			break;
	}
}
 
Example #17
Source File: UARTCommandsActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
	// If the activity is bound to service it means that it has connected directly to the device. We ignore messages from the handheld.
	if (profile != null)
		return;

	switch (messageEvent.getPath()) {
		case Constants.UART.DEVICE_LINKLOSS:
		case Constants.UART.DEVICE_DISCONNECTED: {
			finish();
			break;
		}
	}
}
 
Example #18
Source File: UARTConfigurationsActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
	// If the activity is bound to service it means that it has connected directly to the device. We ignore messages from the handheld.
	if (binder != null)
		return;

	switch (messageEvent.getPath()) {
		case Constants.UART.DEVICE_LINKLOSS:
		case Constants.UART.DEVICE_DISCONNECTED: {
			finish();
			break;
		}
	}
}
 
Example #19
Source File: Emmet.java    From Wear-Emmet with Apache License 2.0 5 votes vote down vote up
public Emmet onMessageReceived(MessageEvent messageEvent) {
    if (messageEvent.getPath().startsWith(PATH)) {
        String messageName = new String(messageEvent.getData());
        callMethodOnInterfaces(messageName);
    }
    return this;
}
 
Example #20
Source File: WearRequestHandler.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
public void sendRequest(MessageEvent messageEvent) {
    if(googlePlayServicesConnected) {
        setWearRequest(messageEvent);
    }
    else {
        messages.add(messageEvent);
    }
}
 
Example #21
Source File: ListenerService.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Reacts on Messages from MessageApi
 *
 * @param messageEvent
 */
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    Toast.makeText(getApplicationContext(), "Message received: " + convertEventDataToString(messageEvent.getData()), Toast.LENGTH_LONG)
            .show();

    if (messageEvent.getPath().equals(WearableConstants.START_ACTIVITY_PATH)) {
        // TODO: Launch Wearable App
        // is this even possible?
    }
}
 
Example #22
Source File: RequestListenerService.java    From arcgis-runtime-demos-android with Apache License 2.0 5 votes vote down vote up
/**
 * Handles issuing a response to a FeatureType request. A FeatureType request
 * indicates that the Wear devices wants a list of available FeatureTypes for
 * the selected layer to display to the user.
 *
 * @param event the MessageEvent from the Wear device
 * @param client the Google API client used to communicate
 */
private void handleFeatureTypeRequest(MessageEvent event, GoogleApiClient client) {
  // Get the name and URL of the layer that was selected
  String layerName = new String(event.getData());
  String url = sLayerMap.get(layerName);
  // Create an ArcGISFeatureLayer with the specified URL
  sArcGISFeatureLayer = new ArcGISFeatureLayer(url, ArcGISFeatureLayer.MODE.SNAPSHOT);

  // While this isn't good practice, there is no way to be notified that an
  // ArcGISFeatureLayer has loaded its LayerServiceInfo. The OnStatusChangedListener
  // seems to be more relevant when the layer is actually being added to a MapView.
  // As such, we simply do a quick sleep until the LayerServiceInfo has been loaded
  try {
    while (sArcGISFeatureLayer.getLayerServiceInfo() == null) {
      Thread.sleep(500);
    }
  } catch (Exception e) {
    //
  }
  // Create a PutDataMapRequest with the FeatureType response path
  PutDataMapRequest req = PutDataMapRequest.create(FEATURE_TYPE_RESPONSE);
  DataMap dm = req.getDataMap();
  // Put an array list of the FeatureType names into the data map
  dm.putStringArrayList("featureTypes", FeatureLayerUtil.getFeatureTypes(sArcGISFeatureLayer));
  // Put the current time into the data map, which forces an onDataChanged event (this event
  // only occurs when data actually changes, so putting the time ensures something always changes)
  dm.putLong("Time", System.currentTimeMillis());
  // Put the DataItem into the Data API stream
  Wearable.DataApi.putDataItem(client, req.asPutDataRequest());
}
 
Example #23
Source File: DaVinciDaemon.java    From DaVinci with Apache License 2.0 5 votes vote down vote up
public void handleMessage(MessageEvent messageEvent) {
    final String path = messageEvent.getPath();

    if (path.equals(MESSAGE_DAVINCI)) {
        String message = new String(messageEvent.getData());
        if (message.startsWith("http") || message.startsWith("www")) {
            String sendPath = message.hashCode() + "";

            load(message).into(DAVINCI_PATH + sendPath);
        }
    }
}
 
Example #24
Source File: CrossbowListenerService.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
@Override
@CallSuper
public void onMessageReceived(MessageEvent messageEvent) {
    if(isCrossBowMessage(messageEvent)) {
        dataItemHandler.sendRequest(messageEvent);
    }
}
 
Example #25
Source File: WatchUpdaterService.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent event) {
    if (wear_integration) {
        if (event != null && event.getPath().equals(WEARABLE_RESEND_PATH))
            resendData();
    }
}
 
Example #26
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
@Override //MessageListener
public void onMessageReceived(final MessageEvent messageEvent) {
    LOGD(TAG, "onMessageReceived() A message from watch was received:" + messageEvent
            .getRequestId() + " " + messageEvent.getPath());
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            mDataItemListAdapter.add(new Event("Message from watch", messageEvent.toString()));
        }
    });

}
 
Example #27
Source File: WearService.java    From DaVinci with Apache License 2.0 5 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    super.onMessageReceived(messageEvent);
    DaVinciDaemon.with(getApplicationContext()).handleMessage(messageEvent);

    ConnectionResult connectionResult = mApiClient.blockingConnect(30, TimeUnit.SECONDS);

    if (!connectionResult.isSuccess()) {
        Log.e(TAG, "Failed to connect to GoogleApiClient.");
        return;
    }


    final String path = messageEvent.getPath();

    if (path.equals("hello")) {

        //DaVinciDaemon.with(getApplicationContext()).load("http://lorempixel.com/400/200/").into("/image/0");

        AndroidService androidService = new RestAdapter.Builder()
                .setEndpoint(AndroidService.ENDPOINT)
                .build().create(AndroidService.class);

        androidService.getElements(new Callback<List<Element>>() {
            @Override
            public void success(List<Element> elements, Response response) {
                sendListElements(elements);
            }

            @Override
            public void failure(RetrofitError error) {
            }
        });

    }
}
 
Example #28
Source File: MessageReceiverService.java    From SensorDashboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    Log.d(TAG, "Received message: " + messageEvent.getPath());

    if (messageEvent.getPath().equals(ClientPaths.START_MEASUREMENT)) {
        startService(new Intent(this, SensorService.class));
    }

    if (messageEvent.getPath().equals(ClientPaths.STOP_MEASUREMENT)) {
        stopService(new Intent(this, SensorService.class));
    }
}
 
Example #29
Source File: DeviceDataListenerService.java    From flopsydroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    if(messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
        Intent watchIntent = new Intent(this, MenuActivity.class);
        watchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(watchIntent);
    }
}
 
Example #30
Source File: EventBus.java    From BusWear with Apache License 2.0 5 votes vote down vote up
/**
 * Will take a MessageEvent from GooglePlayServices and attempt to parse WearEventBus data to sync with the local EventBus
 *
 * @param messageEvent
 */
public void syncEvent(@NonNull MessageEvent messageEvent) {
    byte[] objectArray = messageEvent.getData();

    int indexClassDelimiter = messageEvent.getPath().lastIndexOf(WearBusTools.CLASS_NAME_DELIMITER);
    String className = messageEvent.getPath().substring(indexClassDelimiter + 1);

    boolean isEventMessage = messageEvent.getPath().contains(WearBusTools.MESSAGE_PATH) || messageEvent.getPath().contains(WearBusTools.MESSAGE_PATH_STICKY);

    if (isEventMessage) {

        //Try simple types (String, Integer, Long...)
        Object obj = WearBusTools.getSendSimpleObject(objectArray, className);

        if (obj == null) {
            //Find corresponding parcel for particular object in local receivers
            obj = findParcel(objectArray, className);
        }

        if (obj != null) {

            boolean isSticky = messageEvent.getPath().contains(WearBusTools.MESSAGE_PATH_STICKY);

            //send them to local bus
            if (isSticky) {
                postStickyLocal(obj);
            } else {
                postLocal(obj);
            }
        }

    } else if (messageEvent.getPath().contains(WearBusTools.MESSAGE_PATH_COMMAND)) {

        //Commands used for managing sticky events.
        stickyEventCommand(messageEvent, objectArray, className);
    }
}