@Override public void onRpcRequest(Request rpcRequest) { Log.d(TAG, "onRpcRequest: " + rpcRequest); if (TextUtils.isEmpty(rpcRequest.targetNodeId) || rpcRequest.targetNodeId.equals(wearable.getLocalNodeId())) { MessageEventParcelable messageEvent = new MessageEventParcelable(); messageEvent.data = rpcRequest.rawData != null ? rpcRequest.rawData.toByteArray() : null; messageEvent.path = rpcRequest.path; messageEvent.requestId = rpcRequest.requestId + 31 * (rpcRequest.generation + 527); messageEvent.sourceNodeId = TextUtils.isEmpty(rpcRequest.sourceNodeId) ? peerNodeId : rpcRequest.sourceNodeId; wearable.sendMessageReceived(rpcRequest.packageName, messageEvent); } else if (rpcRequest.targetNodeId.equals(peerNodeId)) { // Drop it } else { // TODO: find next hop } try { getConnection().writeMessage(new RootMessage.Builder().heartbeat(new Heartbeat()).build()); } catch (IOException e) { onDisconnected(); } }
public final void zza(final MessageEventParcelable paramMessageEventParcelable) { zzb(new Runnable() { public final void run() {} }, "onMessageReceived", paramMessageEventParcelable); }
@Override public void onMessageReceived(final MessageEventParcelable messageEvent) throws RemoteException { post(new Runnable() { @Override public void run() { WearableListenerService.this.onMessageReceived(messageEvent); } }); }
public void sendMessageReceived(String packageName, MessageEventParcelable messageEvent) { Log.d(TAG, "onMessageReceived: " + messageEvent); try { getListener(packageName, "com.google.android.gms.wearable.MESSAGE_RECEIVED", Uri.parse("wear://" + getLocalNodeId() + "/" + messageEvent.getPath())) .onMessageReceived(messageEvent); } catch (RemoteException e) { Log.w(TAG, e); } }