Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google-cloud-java][Text-to-Speech][Android] want to use api key #3400

Closed
changemyminds opened this issue Jun 22, 2018 · 6 comments
Closed
Assignees
Labels
android api: texttospeech Issues related to the Text-to-Speech API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@changemyminds
Copy link

changemyminds commented Jun 22, 2018

I use the Text-to-Speech Java Library on my Android app.
I want to use google cloud api-key to use the Text-to-Speech Java Library.

On my android. If I did the following code, it got the error message.

try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { 
}

/* 
error message
java.io.IOException: The Application Default Credentials are not available. 
They are available if running in Google Compute Engine. 
Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials.
See https://developers.google.com/accounts/docs/application-default-credentials for more information.
*/

So I read the Authentication API Keys document and found API-Key not support Text-to-Speech, so I can't use api-key to Text-to-Speech Java Library.

If I want to use Text-to-Speech by API-Key or Text-to-Speech Java Library on Android. How can I do it ?

The following code is my command line and execute on mac and It work fine and can get the "audioContent". I think I can use http method by java. Is there any other way ?

Curl -H "X-Goog-Api-Key: API_KEY" \
  -H "Content-Type: application/json; charset=utf-8" \
  --data "{
    'input':{
      'text':'Hello I am david, Nice to meet you'
    },
    'voice':{
      'languageCode':'en-gb',
      'name':'en-GB-Standard-A',
      'ssmlGender':'FEMALE'
    },
    'audioConfig':{
      'audioEncoding':'MP3'
    }
  }" "https://texttospeech.googleapis.com/v1beta1/text:synthesize"
@JustinBeckwith JustinBeckwith added the triage me I really want to be triaged. label Jun 23, 2018
@changemyminds
Copy link
Author

changemyminds commented Jun 24, 2018

I use http-method to use the API_KEY on Android and it work fine for me.

Here is the example. But if you use restricted Google API key on Android, it can't work.

If the Text-to-Speech Java Library can support the API_KEY, please let me know. Thanks.

@yihanzhen yihanzhen added type: question Request for information or clarification. Not an issue. android priority: p2 Moderately-important priority. Fix may not be included in next release. api: texttospeech Issues related to the Text-to-Speech API. and removed triage me I really want to be triaged. labels Jun 26, 2018
@yihanzhen
Copy link
Contributor

Thanks for the information. Currently there probably won't be a better way, but we are working on an authentication approach for android right now. Please stand by.

@yankarinRG
Copy link

Thanks for the information. Currently there probably won't be a better way, but we are working on an authentication approach for android right now. Please stand by.

Hello @hzyi-google, since your reply is one year old, were there any updates on a dedicated Android library for Google Cloud Text-to-Speech?

Thank you.

@IrfanJam33L
Copy link

heyy can you provide full code? I want to use this API in my app but there is no proper documentation for using it in Android

@yihanzhen
Copy link
Contributor

I stopped working on the Java libraries a while ago so I don't know the latest status.

cc/ @ajaaym @chingor13

@nikste
Copy link

nikste commented Jun 18, 2023

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android api: texttospeech Issues related to the Text-to-Speech API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

6 participants