Я пытаюсь разработать с помощью Android Wear. Я попробовал все учебники, представленные в документации, но теперь я хочу попытаться сделать что-то умнее. Я пытаюсь вернуть текст, который говорит пользователь (с эмулятором, написанным компьютерной клавиатурой), так что я сделал это с этим кодом:Получите ответ после Android Wear Действие
protected void voiceNotification() {
// Crete intent for the response action
Intent replyIntent = new Intent(this, ReplyActivity.class);
// Adding intent to pending intent
PendingIntent replyPendingIntent = PendingIntent.getActivity(this, 0,
replyIntent, 0);
// Build the notification
NotificationCompat.Builder replyNotificationBuilder = new NotificationCompat.Builder(
this);
replyNotificationBuilder
.setSmallIcon(android.R.drawable.ic_btn_speak_now);
replyNotificationBuilder.setContentTitle("Messaggio");
replyNotificationBuilder.setContentText("Testo del messaggio");
replyNotificationBuilder.setContentIntent(replyPendingIntent);
replyNotificationBuilder.setNumber(++numMessages);
replyNotificationBuilder.setAutoCancel(true);
replyNotificationBuilder.setSound(RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
replyNotificationBuilder.setVibrate(new long[] { 1000, 1000 });
replyNotificationBuilder.setTicker("Hai una nuova notifica!");
// Create remote input
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(getResources().getString(R.string.reply_label))
.build();
// Create the wearable notification
Notification replyNotification = new WearableNotifications.Builder(replyNotificationBuilder)
.addRemoteInputForContentIntent(remoteInput)
.build();
// Get the instance of NotificationManagerCompat and send my notification
NotificationManagerCompat.from(this).notify(0, replyNotification);
}
С помощью этого кода на эмуляторе я получаю 2 просмотров: один с текстом моего уведомления и вторым, в котором я могу ответить на уведомление голосом (клавиатура с эмулятором). Он работает хорошо, но я хочу знать, можно ли получить текст, который я сказал (написал с эмулятором), чтобы что-то сделать в моем приложении (я видел на дисплее эмулятора, что после того, как я сказал/написал что-то, появляется 2 кнопки «Редактировать» »и« Отправить », поэтому я думаю, что с кнопкой« Отправить »я могу получить текст в своем приложении, чтобы что-то сделать). Я пытаюсь выяснить что-то в документации, но ничего не нашел. Надеюсь, вы можете помочь мне получить этот текст.
Это выглядит здорово, спасибо, я постараюсь узнать и реализовать в моем демо-приложение :) – lucgian841