本文整理汇总了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;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:WearVibrationProfile.java
示例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;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:WearTouchProfile.java
示例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;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:WearKeyEventProfile.java
示例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();
}
});
}
}
开发者ID:mauriciotogneri,项目名称:shoppinglist,代码行数:18,代码来源:CartActivity.java
示例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();
}
}
});
}
开发者ID:mauriciotogneri,项目名称:shoppinglist,代码行数:26,代码来源:WearableConnectivity.java
示例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();
}
}
});
}
开发者ID:mauriciotogneri,项目名称:tpgwear,代码行数:26,代码来源:WearableConnectivity.java
示例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;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:29,代码来源:WearDeviceOrientationProfile.java
示例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() {
}
});
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:17,代码来源:WearDeviceOrientationProfile.java
示例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");
}
}
}
开发者ID:fadelakin,项目名称:BitWear,代码行数:13,代码来源:MainActivity.java
示例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());
}
}
}
);
}
开发者ID:mauimauer,项目名称:AndroidWearable-Samples,代码行数:15,代码来源:MainActivity.java
示例11: zzad
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
public zzad(zzmu.zzb<MessageApi.SendMessageResult> paramzzb)
{
super();
}
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:zzcd.java
示例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) {});
}
开发者ID:ChiangC,项目名称:FMTech,代码行数:5,代码来源:zzbm.java
示例13: onResult
import com.google.android.gms.wearable.MessageApi.SendMessageResult; //导入依赖的package包/类
@Override
public void onResult(SendMessageResult sendMessageResult) {
}
开发者ID:SimoneCasagranda,项目名称:android-wear-tutorial,代码行数:4,代码来源:Event.java
注:本文中的com.google.android.gms.wearable.MessageApi.SendMessageResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论