本文整理汇总了Java中com.google.android.gms.wearable.MessageApi.SendMessageResult类的典型用法代码示例。如果您正苦于以下问题:Java SendMessageResult类的具体用法?Java SendMessageResult怎么用?Java SendMessageResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SendMessageResult类属于com.google.android.gms.wearable.MessageApi包,在下文中一共展示了SendMessageResult类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRequest
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public boolean onRequest(final Intent request, final Intent response) {
String pattern = getPattern(request);
String nodeId = WearUtils.getNodeId(getServiceID(request));
getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_VIBRATION_RUN,
convertPatternToString(parsePattern(pattern)), new OnMessageResultListener() {
@Override
public void onResult(final SendMessageResult result) {
if (result.getStatus().isSuccess()) {
setResult(response, DConnectMessage.RESULT_OK);
} else {
MessageUtils.setIllegalDeviceStateError(response);
}
sendResponse(response);
}
@Override
public void onError() {
MessageUtils.setIllegalDeviceStateError(response);
sendResponse(response);
}
});
return false;
}
示例2: onRequest
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public boolean onRequest(final Intent request, final Intent response) {
String nodeId = WearUtils.getNodeId(getServiceID(request));
getManager().sendMessageToWear(nodeId,
WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHCHANGE_UNREGISTER,
"", new OnMessageResultListener() {
@Override
public void onResult(final SendMessageResult result) {
}
@Override
public void onError() {
}
});
// Event release.
EventError error = EventManager.INSTANCE.removeEvent(request);
if (error == EventError.NONE) {
setResult(response, DConnectMessage.RESULT_OK);
} else {
setResult(response, DConnectMessage.RESULT_ERROR);
}
return true;
}
示例3: onRequest
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public boolean onRequest(final Intent request, final Intent response) {
String nodeId = WearUtils.getNodeId(getServiceID(request));
getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONDOWN_UNREGISTER, "",
new OnMessageResultListener() {
@Override
public void onResult(final SendMessageResult result) {
}
@Override
public void onError() {
}
});
// Event release.
EventError error = EventManager.INSTANCE.removeEvent(request);
if (error == EventError.NONE) {
setResult(response, DConnectMessage.RESULT_OK);
} else {
setResult(response, DConnectMessage.RESULT_ERROR);
}
return true;
}
示例4: onDestroy
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
protected void onDestroy()
{
super.onDestroy();
if (connectivity != null)
{
connectivity.sendMessage(Messages.clearSelected(nodeId), new ResultCallback<SendMessageResult>()
{
@Override
public void onResult(SendMessageResult sendMessageResult)
{
connectivity.disconnect();
}
});
}
}
示例5: sendMessage
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public synchronized void sendMessage(final Message message, final ResultCallback<SendMessageResult> callback)
{
threadPool.execute(new Runnable()
{
@Override
public void run()
{
apiClient.blockingConnect(TIMEOUT, TimeUnit.MILLISECONDS);
try
{
PendingResult<SendMessageResult> pendingResult = Wearable.MessageApi.sendMessage(apiClient, message.getNodeId(), message.getPath(), message.getPayload());
if (callback != null)
{
pendingResult.setResultCallback(callback);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
示例6: sendMessage
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public synchronized void sendMessage(final Message message, final ResultCallback<SendMessageResult> callback)
{
threadPool.execute(new Runnable()
{
@Override
public void run()
{
apiClient.blockingConnect(TIMEOUT, TimeUnit.MILLISECONDS);
try
{
PendingResult<SendMessageResult> pendingResult = Wearable.MessageApi.sendMessage(apiClient, message.getNodeId(), message.getPath(), message.getPayloadAsBytes());
if (callback != null)
{
pendingResult.setResultCallback(callback);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
示例7: onRequest
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public boolean onRequest(final Intent request, final Intent response) {
String nodeId = WearUtils.getNodeId(getServiceID(request));
getManager().sendMessageToWear(nodeId,
WearConst.DEVICE_TO_WEAR_DEIVCEORIENTATION_REGISTER,
"", new OnMessageResultListener() {
@Override
public void onResult(final SendMessageResult result) {
if (result.getStatus().isSuccess()) {
EventError error = EventManager.INSTANCE.addEvent(request);
if (error == EventError.NONE) {
setResult(response, DConnectMessage.RESULT_OK);
} else {
setResult(response, DConnectMessage.RESULT_ERROR);
}
} else {
MessageUtils.setIllegalDeviceStateError(response);
}
sendResponse(response);
}
@Override
public void onError() {
MessageUtils.setIllegalDeviceStateError(response);
sendResponse(response);
}
});
return false;
}
示例8: stopSensor
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
/**
* 指定されたWearのセンサーを停止する.
* @param nodeId wearのID
*/
private void stopSensor(final String nodeId) {
getManager().sendMessageToWear(nodeId,
WearConst.DEVICE_TO_WEAR_DEIVCEORIENTATION_UNREGISTER,
"", new OnMessageResultListener() {
@Override
public void onResult(final SendMessageResult result) {
}
@Override
public void onError() {
}
});
}
示例9: run
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public void run() {
NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(mApiClient).await();
for(Node node : nodes.getNodes()) {
SendMessageResult result = Wearable.MessageApi.sendMessage(mApiClient, node.getId(), path, message.getBytes()).await();
if(result.getStatus().isSuccess()) {
Log.v("myTag", "Message: {" + message + "} sent to: " + node.getDisplayName());
} else {
// Log an error
Log.v("myTag", "ERROR: failed to send message");
}
}
}
示例10: sendStartActivityMessage
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
private void sendStartActivityMessage(String node) {
Wearable.MessageApi.sendMessage(
mGoogleApiClient, node, START_ACTIVITY_PATH, new byte[0]).setResultCallback(
new ResultCallback<SendMessageResult>() {
@Override
public void onResult(SendMessageResult sendMessageResult) {
if (!sendMessageResult.getStatus().isSuccess()) {
Log.e(TAG, "Failed to send message with status code: "
+ sendMessageResult.getStatus().getStatusCode());
}
}
}
);
}
示例11: zzad
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public zzad(zzmu.zzb<MessageApi.SendMessageResult> paramzzb)
{
super();
}
示例12: sendMessage
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public final PendingResult<MessageApi.SendMessageResult> sendMessage(GoogleApiClient paramGoogleApiClient, final String paramString1, final String paramString2, final byte[] paramArrayOfByte)
{
paramGoogleApiClient.zza(new zzi(paramGoogleApiClient) {});
}
示例13: onResult
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public void onResult(SendMessageResult sendMessageResult) {
}