gpt4 book ai didi

com.google.android.gms.wearable.Wearable.getMessageClient()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 01:49:05 24 4
gpt4 key购买 nike

本文整理了Java中com.google.android.gms.wearable.Wearable.getMessageClient()方法的一些代码示例,展示了Wearable.getMessageClient()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wearable.getMessageClient()方法的具体详情如下:
包路径:com.google.android.gms.wearable.Wearable
类名称:Wearable
方法名:getMessageClient

Wearable.getMessageClient介绍

暂无

代码示例

代码示例来源:origin: JimSeker/wearable

@Override
public void onPause() {
  super.onPause();
  Wearable.getMessageClient(this).removeListener(this);
}

代码示例来源:origin: JimSeker/wearable

@Override
public void onResume() {
  super.onResume();
  Wearable.getMessageClient(this).addListener(this);
}

代码示例来源:origin: Calsign/APDE

public void run() {
    try {
      JSONObject json = new JSONObject();
      json.put("severity", Character.toString(severity));
      json.put("message", message);
      json.put("exception", exception);
      byte[] data = json.toString().getBytes();
      
      if (bestNodeId != null) {
        Wearable.getMessageClient(context).sendMessage(bestNodeId, "/apde_receive_logs", data);
      }
    } catch (Exception e) {
      // Don't call printStackTrace() because that would make an infinite loop
      Log.e("apde", e.toString());
    }
  }
});

代码示例来源:origin: JimSeker/wearable

@Override
public void onPause() {
  super.onPause();
  Wearable.getMessageClient(this).removeListener(this);
}

代码示例来源:origin: JimSeker/wearable

@Override
public void onResume() {
  super.onResume();
  Wearable.getMessageClient(this).addListener(this);
}

代码示例来源:origin: googlesamples/android-DataLayer

@Override
public void onResume() {
  super.onResume();
  mDataItemGeneratorFuture =
      mGeneratorExecutor.scheduleWithFixedDelay(
          new DataItemGenerator(), 1, 5, TimeUnit.SECONDS);
  mStartActivityBtn.setEnabled(true);
  mSendPhotoBtn.setEnabled(mCameraSupported);
  // Instantiates clients without member variables, as clients are inexpensive to create and
  // won't lose their listeners. (They are cached and shared between GoogleApi instances.)
  Wearable.getDataClient(this).addListener(this);
  Wearable.getMessageClient(this).addListener(this);
  Wearable.getCapabilityClient(this)
      .addListener(this, Uri.parse("wear://"), CapabilityClient.FILTER_REACHABLE);
}

代码示例来源:origin: googlesamples/android-DataLayer

@WorkerThread
private void sendStartActivityMessage(String node) {
  Task<Integer> sendMessageTask =
      Wearable.getMessageClient(this).sendMessage(node, START_ACTIVITY_PATH, new byte[0]);
  try {
    // Block on a task and get the result synchronously (because this is on a background
    // thread).
    Integer result = Tasks.await(sendMessageTask);
    LOGD(TAG, "Message sent: " + result);
  } catch (ExecutionException exception) {
    Log.e(TAG, "Task failed: " + exception);
  } catch (InterruptedException exception) {
    Log.e(TAG, "Interrupt occurred: " + exception);
  }
}

代码示例来源:origin: googlesamples/android-DataLayer

@Override
public void onPause() {
  super.onPause();
  mDataItemGeneratorFuture.cancel(true /* mayInterruptIfRunning */);
  Wearable.getDataClient(this).removeListener(this);
  Wearable.getMessageClient(this).removeListener(this);
  Wearable.getCapabilityClient(this).removeListener(this);
}

代码示例来源:origin: JimSeker/wearable

public void run() {
    //first get all the nodes, ie connected wearable devices.
    Task<List<Node>> nodeListTask =
      Wearable.getNodeClient(getApplicationContext()).getConnectedNodes();
    try {
      // Block on a task and get the result synchronously (because this is on a background
      // thread).
      List<Node> nodes = Tasks.await(nodeListTask);
      //Now send the message to each device.
      for (Node node : nodes) {
        Task<Integer> sendMessageTask =
          Wearable.getMessageClient(MainActivity.this).sendMessage(node.getId(), path, message.getBytes());
        try {
          // Block on a task and get the result synchronously (because this is on a background
          // thread).
          Integer result = Tasks.await(sendMessageTask);
          Log.v(TAG, "SendThread: message send to " + node.getDisplayName());
        } catch (ExecutionException exception) {
          Log.e(TAG, "Task failed: " + exception);
        } catch (InterruptedException exception) {
          Log.e(TAG, "Interrupt occurred: " + exception);
        }
      }
    } catch (ExecutionException exception) {
      Log.e(TAG, "Task failed: " + exception);
    } catch (InterruptedException exception) {
      Log.e(TAG, "Interrupt occurred: " + exception);
    }
  }
}

代码示例来源:origin: JimSeker/wearable

Wearable.getMessageClient(MainActivity.this).sendMessage(node.getId(), path, message.getBytes());

代码示例来源:origin: Calsign/APDE

Wearable.getMessageClient(this).addListener(wearConsoleReceiver);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com