RecognizerIntent change default language

A guide to the Android Wear Message API | Java

  • wear에서 mobile로 전달할 data가 있는 경우 data item, 

    DataMapItem 또는 message, assets등등의 방법을 이용할수 있다. 쌍방의 통신이 필요한경우는 DataItem , DataMapItem을 이용하면되고 일방의 통신의 경우는 Message를 이용할수 있다. (RPC 처럼 사용 가능) 

  • Message를 사용하는 경우(DataItem,DataMapItem의 경우는 사용해보지 않아서 같은지 아직 모름) 일단 네트워크의 node를 확인해야한다. 그리고 가장 가까운 기기기 node(mobile인경우가 대부분)가 접속되었는지, 또 message작업이 가능한지 capability를 확인해야 한다. 그리고 나서 data는 byte[]의 형태로 MessageApi.sendMessage를 통해 전달된다. 그리고 message를 mobile에서 받는 경우 두가지 경우를 생각할수 있다. 
  1. 사용자가 app을 사용하고 있는 경우
  2. 사용자가 app을 사용하지 않고 있는 경우

첫번째 경우에만 통신이 필요한경우는  MessageApi.MessageListener를 inplements 한 activity가 받아들이면된다. 후자의 경우는 service를 이용해서 받는다.

Syncing Data Between Android Handhelds and Wearables – Developer.com

original source : https://developer.android.com/training/wearables/apps/debugging.html

실제 기기들을 이용해서 하는 debug 설정

mobile은 usb로 개발용 컴퓨터에 연결, wear는 bluetooth를 통해 mobile을 거쳐 r개발용 컴퓨터에 연결하는 방법

Enable Developer Options on your watch

Before you can debug on your watch you must enable developer options. You only need to do this one time. Developer options remain enabled until you disable them.

  1. Open the watch’s Settings.
  2. Tap System > About.
  3. Scroll to Build number and tap the build number seven times.
  4. A dialog will appear confirming that you are now a developer.

Debugging over Bluetooth

Bluetooth debugging only works for Android-paired watches. Before you begin, be sure the watch and phone are paired and you’ve enabled developer options on the watch. You should also be sure that developer options is also enabled on the phone. To check, open the phone’s Settings menu, selectAbout phone and click the build number seven times.

Enable USB debugging on the phone

  1. Open the phone’s Settings menu.
  2. Select Developer Options and enable USB debugging.

Enable ADB/Bluetooth debugging on the watch

  1. Open the watch’s Settings menu.
  2. Scroll to Developer Options.
  3. Confirm that ADB debugging is enabled.
  4. Enable Debug over Bluetooth.

Enable Bluetooth debugging on the phone

(mobile기기에 설치된 android wear 앱의 기본화면)

image

(mobile기기에 설치된 android wear 앱의 설정화면)

image

(하단의 Debugging over Bluetooth 을 enale해야한다. 5번 내용)

  1. On the phone, open the Android Wear companion app.
  2. Tap the Settings icon.
  3. Enable Debugging over Bluetooth. A status message appears under the option. It looks like this:
Host: disconnected
Target: connected

At this point the development machine (the host) is not communicating with with the watch (the target). You need to complete the link.

Connect the debugger to the watch

In this final step, you’ll use everything: the debugger, the phone, and the watch.

C:UsersjacobAppDataLocalAndroidsdkplatform-tools> 경로안에 adb 가들어있다. 그러므로 이 폴더 안으로 들어가서 아래 명령어를 실행한다.

(이작업은 handheld기기가 컴퓨터와 연결이 끊어지거나 android studio 가 새로 시작되면 매번 다시해야 하는 작업이다.)

image
adb forward tcp:4444 localabstract:/adb-hub
adb connect 127.0.0.1:4444

Note: You must use the IP address 127.0.0.1. You can use any available port on your development machine. Be sure you use the same port in both commands. (In this example the port is 4444.)

Host: connected
Target: connected

The watch is now connected to the debugger and you’re ready to start debugging.

When you debug a watch using Bluetooth, adb always uses the IP address 127.0.0.1 plus the port that you assigned. Therefore, all adb commands use this format (continuing the example, the port is 4444):

adb -s 127.0.0.1:4444 <command> 

If you are not using the emulator and have only one device connected for debugging, you don’t need to specify the address at all:

adb <command>

mac os의 경우 
https://stackoverflow.com/questions/17901692/set-up-adb-on-mac-os-x

Option 2 – Manually (just the platform tools)

This is the easiest way to get a manual installation of ADB and Fastboot.

Delete your old installation (optional)

rm -rf ~/.android-sdk-macosx/

Navigate to https://developer.android.com/studio/releases/platform-tools.html and click on the SDK Platform-Tools for Mac link.

Go to your Downloads folder

cd ~/Downloads/

Unzip the tools you downloaded

unzip platform-tools-latest*.zip 

Move them somewhere you won’t accidentally delete them

mkdir ~/.android-sdk-macosx
mv platform-tools/ ~/.android-sdk-macosx/platform-tools

Add platform-tools to your path

echo 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile

Refresh your bash profile (or restart your terminal app)

source ~/.bash_profile

Start using adb

adb devices