Kaljurand / K6nele

An Android app that offers speech-to-text user interfaces to other apps
http://kaljurand.github.io/K6nele/
Apache License 2.0
267 stars 83 forks source link

insufficient permissions on Android Emulator (Nexus 5 API 26) #51

Closed mariasmo closed 5 years ago

mariasmo commented 6 years ago

hi kaljurand,

i am trying to run this on Android emulator in my Android Studio(I do not have an Android Phone) and I am getting this error.

Any suggestions on how to get over this(i tried the option you suggested in one of the closed issues but did not seem to work)?

thanks

Kaljurand commented 6 years ago

It would be important to know more details to be able to understand this, e.g.

If it is about Kõnele lacking the audio recording permission then you could try to grant it after installation using "adb":

adb shell pm grant ee.ioc.phon.android.speak android.permission.RECORD_AUDIO
mariasmo commented 6 years ago

hi kaljurand,

sorry. i should have been more explicit.

1) it's the microphone permission issue 2) the error shows up on the yellow initial dialog when we press the microphone icon 3) i was referenceing #43

i will try the adb command you suggested.

however i was able to use the android client app that you referenced in your code: https://github.com/truongdo/kaldi-gstreamer-android-client

i had some problems building the above mentioned project but once i built it i did not have the mic permissions issue(ofcourse i am not able to get any transcribed output though. may be bcos i am speaking english instead of Estonian? i will be posting this question to alumae though)

thanks

Kaljurand commented 6 years ago

It think this is not an error but the standard permissions asking dialog that pops up.

screenshot_1512208759

Just press "Allow", or run on the commandline:

adb shell pm grant ee.ioc.phon.android.speak android.permission.RECORD_AUDIO

Recording/transcription seems to work fine on my emulator. (But there have been issues with recording on an emulator in the past.) For a non-Estonian server, consider setting up your own server, e.g. based on https://github.com/jcsilva/docker-kaldi-gstreamer-server

(https://github.com/truongdo/kaldi-gstreamer-android-client targets an older version of Android that does not support runtime permissions, i.e. all permissions are granted automatically at installation time. I guess that is why there is no additional popup.)

mariasmo commented 6 years ago

hi kaljurand,

thanks for the response. i was able to get past the permissions error by running the adb command you suggested.

now i am able to speak into i.but as soon as i finish the speaking and press the mic button it brings up the google search screen. is this how its supposed to work?

you are right. the "truongdo" android client targets an older version. but the reason i was trying to get it working is bcos it's simpler than the one you have created.yours is quite robust and has lot more features.honestly it's little bit overhelming for me to learn your sample as i am relatively new to android.

i just want to write a bare bones android client that will talk to the kaldi-gstreamer serrvice running on my server with my trained english models and just spits out the transcribed text to be shown on the android client app(this is the way i want to get my feet wet. once i make some progress i will reference your code for adding more features)

can u please suggest what files i need to look into in your sample to achieve my goal? or if there is an easier android client sample that i will be able to quickly modify for my needs?

thanks in advance

mariasmo commented 6 years ago

hi kaljurand,

following this https://github.com/jcsilva/docker-kaldi-gstreamer-server really helped me understand the app. i got ur app working on a notepad like app on my android emulator. thanks.

now if only i can write a bare bones version of your app i will be very very happy. any help is greatly appreciated.

mariasmo commented 6 years ago

hi kaljurand,

sorry.one more question. i am looking at the architecture diagram in the README and the way i understood it is that the net-speech-api is only used for the http based Grammar recognition for the pocket-sphinx server. since in my case i will not be using the porcket-sphinx server, is it safe to remove this module?

thanks

Kaljurand commented 6 years ago

By default, Kõnele shows the transcription using a web search activity (e.g. "google search"). This can be changed by calling Kõnele from another app (instead of the launcher), or by using rewrite rules.

Yes, net-speech-api is not really requred for the kaldi-gstreamer-server. However, there is currently a dependency via ChunkedWebRecSessionBuilder, which is probably not so difficult to remove.

In order to get a basic kaldi-gstreamer-server client working, take the code from https://github.com/Kaljurand/speechdemo1 and add the following Kõnele classes to it:

https://github.com/Kaljurand/K6nele/blob/master/app/src/main/java/ee/ioc/phon/android/speak/service/AbstractRecognitionService.java

https://github.com/Kaljurand/K6nele/blob/master/app/src/main/java/ee/ioc/phon/android/speak/service/WebSocketRecognitionService.java

However, even simpler is if you can assume that Kõnele is installed on the device, i.e. maybe you can bundle it with your app somehow. Then you just need to call the standard Android speech API from your app and require that it should be serviced by Kõnele. You can specify your server via the SERVER_URL extra. (See also: http://kaljurand.github.io/K6nele/docs/en/developer_guide.html).

mariasmo commented 6 years ago

awesome.thank you for your patient and prompt responses.really appreciate it. will let you know how it goes.

thanks again.