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

두종류의 voice action types

  • System-provided  이미 시스템상에서 지정된 voice action
  • App-provided  app에서 지정하거나 특정 app의 activity를 실행하는 경우

Declare System-provided Voice Actions

When users speak the voice action, your app can filter for the intent that is fired to start an activity. If you want to start a service to do something in the background, show an activity as a visual cue and start the service in the activity. Make sure to call finish() when you want to get rid of the visual cue.

<activity android:name="MyNoteActivity">
         <action android:name="android.intent.action.SEND" />
         <category android:name="com.google.android.voicesearch.SELF_NOTE" />

몇몇의 voice intent의 예시들

더 많은 voice intent를 참조하려명 

see Common intents.

Declare App-provided Voice Actions

you can start your apps directly with a “Start MyActivityName” voice action.

 <activity android:name="StartRunActivity" android:label="MyRunningApp">
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.LAUNCHER" />

label에 해당하는 내용이 Start 다음에 들어갈 명령어에 해당한다.

Obtaining Free-form Speech Input(사용자로 부터 음성으로 입력값을 받는 방법)

private static final int SPEECH_REQUEST_CODE = 0;

// Create an intent that can start the Speech Recognizer activity
private void displaySpeechRecognizer() {
   Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
// Start the activity, the intent will be populated with the speech text
   startActivityForResult(intent, SPEECH_REQUEST_CODE);

// This callback is invoked when the Speech Recognizer returns.
// This is where you process the intent and extract the speech text from the intent.
protected void onActivityResult(int requestCode, int resultCode,
       Intent data) {
   if (requestCode == SPEECH_REQUEST_CODE && resultCode == RESULT_OK) {
       List<String> results = data.getStringArrayListExtra(
       String spokenText = results.get(0);
       // Do something with spokenText
   super.onActivityResult(requestCode, resultCode, data);

startActivityForResult() 를 통해 음성으로 입력값을 받을 activity를 실행한다.이때 action은 

ACTION_RECOGNIZE_SPEECH 으로 지정한다. 그리고 그 결과는 

onActivityResult() 에서 받을수 있다.

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

Planning Your Apps

Generally, the minimum and target API level for a standalone app, and for Wear 2.0, is level 25. The minimum SDK level can be 23 only if you are using the same APK for Wear 1.0 and 2.0

1.0의 경우는 wearable apk가 mobile apk에 포함되어있다. 2.0의 경우에는 분리되어야 하며 각각 따로 google play에 올려져야한다.

Identifying an app as standalone

watch app이 완전 또는 semi 완전하게 독립된 app인경우. watch app의 manifest 에 아래사항을 기입한다.

   android:value="true" />

Shared Code and Data Storage

  • Code can be shared between a Wear app and a phone app.
  • You can use standard Android storage APIs to store data locally. For example, you can use the SharedPreferences APIs, SQLite, or internal storage

Detecting Your App on Another Device

Your phone app or watch app can use the CapabilityApi to advertise the app’s presence to a paired device. It can do so statically and dynamically. When an app is on a node in a user’s Wear network (i.e., on a phone, paired watch, or in the cloud)

Specifying capability names for detecting your apps

For the app corresponding to each device type (watch or phone), specify a unique string for the capability name in the res/values/wear.xml file(mobile쪽에서 또 watch 쪽에서도 양쪽다).

App detection and opening a URL from a watch

  1. Use the CapabilityApi to check if your phone app is installed on the paired phone. For more information, see the sample.
  2. If your phone app isn’t installed on the phone, use the PhoneDeviceType.getPhoneDeviceType() method to check the type of the phone.
  3. If PhoneDeviceType.DEVICE_TYPE_ANDROID is returned, the phone is an Android phone. Call RemoteIntent.startRemoteActivity() on the Wear device to open the app store on the phone. Use the market URI for your phone app (which may be different from your phone URI). For example, use a market URI such as: market://details?id=com.example.android.wearable.wear.finddevices
  4. If PhoneDeviceType.DEVICE_TYPE_IOS is returned, it means the phone is an iOS phone (with no Play Store available). Open the App Store on the iPhone by calling RemoteIntent.startRemoteActivity() on the Wear device. You can specify your app’s iTunes URL, e.g., https://itunes.apple.com/us/app/yourappname. On an iPhone, from Android Wear, you cannot programmatically determine if your phone app is installed. As a best practice, provide a mechanism to the user (e.g., a button) to manually trigger the opening of the App Store.

Details for detecting the type of paired phone

int phoneDeviceType =

App detection starting from an Android phone

  1. Using the NodeApi, find all watches connected to the user’s phone. For more information, see the sample.
  2. Using the CapabilityApi, check which of the user’s watches have your app installed.
  3. If your app isn’t installed on all of the user’s watches (compare the results from Step 1 with the results from Step 2), allow the user to open the Play Store on the remaining Wear devices from the phone via the RemoteIntent.startRemoteActivity() method. Specifically, use the market URI for the Wear app (which may be different from your phone app’s URI). For example, use a market URI such as: market://details?id=com.example.android.wearable.wear.finddevices

Close application and remove from recent apps/

How do you send a Firebase Notification to all devices via CURL?