에서 영구 notification
일종의 텍스트, 그리고 내 목표는 같다이구글의 음성은 내가 만든 알림
1) 사용자는 notification
2) Google Speech to Text activity
시작에 도청 및 음성 입력을 받아
3) 입력이 텍스트로 변환되고 새 활동이 시작되어 텍스트가 표시됩니다.
는 여기에 지금 far-- 시도했습니다 무엇
지금은 내가 일반적으로 startActivityForResult(resultIntent, REQ_CODE_SPEECH_INPUT);
를 사용하여 내 activity
에서 그것을 처리하여 인식기 Intent
의 결과를 처리 할 수 있다는 것을 알고
NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this)
.setSmallIcon(android.R.drawable.ic_dialog_alert)
.setContentTitle("Tap for voice input")
.setContentText("Hi");
Intent resultIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
resultIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
resultIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
resultIntent.putExtra(RecognizerIntent.EXTRA_PROMPT,
getString(R.string.speech_prompt));
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
Notification notification = builder.build();
notification.flags = Notification.FLAG_NO_CLEAR;
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(MainActivity.this);
notificationManager.notify(0, notification);
.
그러나 notification
의 경우 pendingIntent
에 내 의도를 전달해야합니다.
나는 이것을 얻을 수있는 어떤 방법이라도?
편집 1 :
나는 새로운 활동을 시작하고 개방 음성 Google 음성 프롬프트하지만 추가 매개 변수와 같이 시작하기 전에 나는 나의 활동에 전달하기 위해 변환 된 문자열을 할 수 있습니다 의도 ...
내가 제공 한 답변이 필요에 가장 적합하다고 생각합니다. 그렇지 않으면 더 많은 기술을 얻으려면 'SpeechRecognizer' 클래스를 사용하여 서비스에서 음성 입력을 가져온 다음 해당 매개 변수를 활동이 완료되면 활동. – brandall