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

The following examples show how to use com.google.android.gms.wearable.MessageClient. 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: WearDataLayerListenerService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public static void sendMessageToWatch(final String path, final byte[] data, String capability){
	Wearable.getCapabilityClient(ApplicationLoader.applicationContext)
			.getCapability(capability, CapabilityClient.FILTER_REACHABLE)
			.addOnCompleteListener(new OnCompleteListener<CapabilityInfo>(){
				@Override
				public void onComplete(@NonNull Task<CapabilityInfo> task){
					CapabilityInfo info=task.getResult();
					if(info!=null){
						MessageClient mc=Wearable.getMessageClient(ApplicationLoader.applicationContext);
						Set<Node> nodes=info.getNodes();
						for(Node node:nodes){
							mc.sendMessage(node.getId(), path, data);
						}
					}
				}
			});
}
 
Example #2
Source File: WearDataLayerListenerService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public static void sendMessageToWatch(final String path, final byte[] data, String capability){
	Wearable.getCapabilityClient(ApplicationLoader.applicationContext)
			.getCapability(capability, CapabilityClient.FILTER_REACHABLE)
			.addOnCompleteListener(new OnCompleteListener<CapabilityInfo>(){
				@Override
				public void onComplete(@NonNull Task<CapabilityInfo> task){
					CapabilityInfo info=task.getResult();
					if(info!=null){
						MessageClient mc=Wearable.getMessageClient(ApplicationLoader.applicationContext);
						Set<Node> nodes=info.getNodes();
						for(Node node:nodes){
							mc.sendMessage(node.getId(), path, data);
						}
					}
				}
			});
}
 
Example #3
Source File: WearDataLayerListenerService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public static void sendMessageToWatch(final String path, final byte[] data, String capability) {
	Wearable.getCapabilityClient(ApplicationLoader.applicationContext)
			.getCapability(capability, CapabilityClient.FILTER_REACHABLE)
			.addOnCompleteListener(task -> {
				CapabilityInfo info = task.getResult();
				if (info != null) {
					MessageClient mc = Wearable.getMessageClient(ApplicationLoader.applicationContext);
					Set<Node> nodes = info.getNodes();
					for (Node node : nodes) {
						mc.sendMessage(node.getId(), path, data);
					}
				}
			});
}