Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
Cómo hacer un servicio de detección de palabras activas en Android

Quiero crear un servicio que debería escuchar hotword en segundo plano de modo que cuando diga hola debería invocar una actividad, ¿cómo puedo hacer esto, sobre voiceInteractionService pero he leído que no está disponible para usar, es verdad? ¿alguien podría decirme la forma en que debo resolver este problema? Se trata del detector de palabras activas

he estado siguiendo esto

Intenté esto:

 public class InteractionService extends VoiceInteractionService { static final String TAG = "InteractionService" ; private AlwaysOnHotwordDetector mHotwordDetector; @Override public void onCreate() { super.onCreate(); Log.i(TAG, "service started"); } @Override public void onReady() { super.onReady(); Log.i(TAG, "Creating " + this); mHotwordDetector = createAlwaysOnHotwordDetector("Hello" , Locale.forLanguageTag("en-US"), mHotwordCallback); Log.i(TAG, "onReady"); } private final AlwaysOnHotwordDetector.Callback mHotwordCallback = new AlwaysOnHotwordDetector.Callback() { @Override public void onAvailabilityChanged(int status) { Log.i(TAG, "onAvailabilityChanged(" + status + ")"); hotwordAvailabilityChangeHelper(status); } @Override public void onDetected(AlwaysOnHotwordDetector .EventPayload eventPayload) { Log.i(TAG, "onDetected"); } @Override public void onError() { Log.i(TAG, "onError"); } @Override public void onRecognitionPaused() { Log.i(TAG, "onRecognitionPaused"); } @Override public void onRecognitionResumed() { Log.i(TAG, "onRecognitionResumed"); } }; private void hotwordAvailabilityChangeHelper(int status) { Log.i(TAG, "Hotword availability = " + status); switch (status) { 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(0)) { Log.i(TAG, "startRecognition succeeded"); } else { Log.i(TAG, "startRecognition failed"); } break; } // final static AlwaysOnHotwordDetector.Callback }}
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

La demostración del servicio de Porcupine hace exactamente esto.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!