MainInteractionServicepublic class MainInteractionService extends android.service.voice.VoiceInteractionService
Fields Summary |
---|
static final String | TAG | private final android.service.voice.AlwaysOnHotwordDetector.Callback | mHotwordCallback | private android.service.voice.AlwaysOnHotwordDetector | mHotwordDetector |
Methods Summary |
---|
private void | hotwordAvailabilityChangeHelper(int availability)
Log.i(TAG, "Hotword availability = " + availability);
switch (availability) {
case AlwaysOnHotwordDetector.STATE_HARDWARE_UNAVAILABLE:
Log.i(TAG, "STATE_HARDWARE_UNAVAILABLE");
break;
case AlwaysOnHotwordDetector.STATE_KEYPHRASE_UNSUPPORTED:
Log.i(TAG, "STATE_KEYPHRASE_UNSUPPORTED");
break;
case AlwaysOnHotwordDetector.STATE_KEYPHRASE_UNENROLLED:
Log.i(TAG, "STATE_KEYPHRASE_UNENROLLED");
Intent enroll = mHotwordDetector.createEnrollIntent();
Log.i(TAG, "Need to enroll with " + enroll);
break;
case AlwaysOnHotwordDetector.STATE_KEYPHRASE_ENROLLED:
Log.i(TAG, "STATE_KEYPHRASE_ENROLLED - starting recognition");
if (mHotwordDetector.startRecognition(
AlwaysOnHotwordDetector.RECOGNITION_FLAG_NONE)) {
Log.i(TAG, "startRecognition succeeded");
} else {
Log.i(TAG, "startRecognition failed");
}
break;
}
| public void | onReady()
super.onReady();
Log.i(TAG, "Creating " + this);
Log.i(TAG, "Keyphrase enrollment error? " + getKeyphraseEnrollmentInfo().getParseError());
Log.i(TAG, "Keyphrase enrollment meta-data: "
+ Arrays.toString(getKeyphraseEnrollmentInfo().listKeyphraseMetadata()));
mHotwordDetector = createAlwaysOnHotwordDetector(
"Hello There", Locale.forLanguageTag("en-US"), mHotwordCallback);
| public int | onStartCommand(android.content.Intent intent, int flags, int startId)
Bundle args = new Bundle();
args.putParcelable("intent", new Intent(this, TestInteractionActivity.class));
startSession(args);
stopSelf(startId);
return START_NOT_STICKY;
|
|