. Привет. Я следую Google documentation, чтобы открыть фиктивное приложение с помощью команды «Пуск», но не работает для меня.Износ: откройте мое приложение с помощью пользовательского голоса. Команда «Пуск», не работает.
Я создал новый проект по умолчанию с помощью мастера Android Studio с мобильным устройством и модулем износа.
Я не трогал ничего, кроме «андроида: ярлык» манифестного модуля одежды «Hola» (привет на испанском языке), и когда я говорю «Iniciar Hola» («Начать Hello»), Wear делает поиск в Google с помощью ключевое слово hola.
Модуль износа или мобильный модуль не запускаются.
Что я пропускаю: '(кажется, довольно легко из Документах Google ...
PS: Я проверяю через BT на износ устройства
Mobile манифеста
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.basetis.wearapp" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Mobile Activity
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Wear Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.basetis.wearapp" >
<uses-feature android:name="android.hardware.type.watch" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
<activity
android:name=".WearActivity"
android:label="Hola" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Носите активность
public class WearActivity extends Activity {
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wear);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
}
}
Итак, вы имеете в виду, что если я поставлю ярлык активности «hola» на мобильную сторону, приложение будет запущено? – rubdottocom
Мобильное приложение будет запущено, в котором вы можете отправить сообщение на часы, чтобы открыть конкретную операцию. – TWilly
Это ошибка - голосовые команды могут использоваться для запуска приложений Wear. Https://developer.android.com/training/wearables/apps/voice.html#AppProvided – fixermark