How can I send audio data from android studio (java) to my azure function?

Jose Joab Romero Humba 41 Reputation points
2021-05-24T22:08:30+00:00

I'm creating an app in android studio and I need to send some data to my api on azure function. I know how to do it in python but I need to do it in java.

here is the code
def validarPerfil(email, src):
session = requests.Session()

    headers = {"content-type": "application/json",
                "Ocp-apim-subscription-key": key,
                "locale": "es-mx"
    }
    f=open(src,"rb")
    audioCod = f.read()
    f.close()
    parametros3 = audioCod
    url = f'https://gatervoz-api.azurewebsites.net/api/verificarPerfil?code=JsAEPtnWpLEoj1x56V6aeGYjtug3DoBSxiKULRaPoo3OnR1duK3Dpg==&email={email}'
    req = session.post(url, data=parametros3, headers=headers)

    print(req._content)

Thank you in advance

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MikeUrnun 9,777 Reputation points Moderator
    2021-05-26T07:22:47.867+00:00

    Hi @Jose Joab Romero Humba - Does everything already work OK on the Azure Functions side? On the Android client side of things, I'm not a Java dev but I've come across the following sample which might be helpful in getting started: https://github.com/youravgjoe/Android-Audio-File-Upload


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.