Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:56:37+00:00 2026-05-30T23:56:37+00:00

I am able to send a request from an Android program to a remote

  • 0

I am able to send a request from an Android program to a remote server, but it seems the request has no parameters. How do I attach parameters?

Here is my current code:

    @Override
    protected String doInBackground(String... theParams) 
    {

        String myUrl = theParams[0];
        final String myEmail = theParams[1];
        final String myPassword = theParams[2];

        Authenticator.setDefault(new Authenticator()
        {
            protected PasswordAuthentication getPasswordAuthentication() 
            {
                return new PasswordAuthentication( myEmail, myPassword.toCharArray());
            }
        });         

        String response = null;

        try 
        {
            final URL url = new URL(myUrl);

            final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("login", myEmail);
            conn.setRequestProperty("password", myPassword);

            conn.setUseCaches(false);

            final InputStream is = conn.getInputStream();
            final byte[] buffer = new byte[8196];
            int readCount;
            final StringBuilder builder = new StringBuilder();
            while ((readCount = is.read(buffer)) > -1) 
            {
                builder.append(new String(buffer, 0, readCount));
            }

                response = builder.toString();      
            Log.d( "After call, response: " , " " + response);
        } 
        catch (Exception e) 
        {

        }

        return response;
    }

So now I am not sure how to make the Authenticator password/login get attached to the request and get sent to the server. Any idea how I can accomplish that?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:56:38+00:00Added an answer on May 30, 2026 at 11:56 pm

    You simply do this

    final URL url = new URL(myUrl+"?login="+myEmail+"&password="+myPassword);
    

    And you do not need the setRequestProperty lines. Those are actually setting your Http Request’s properties and not the query params.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to build Android application using Java which is able to send request
class ... { onClick() { while(true) { //call the thread from here threadpool(request)//send request
I'm writing an Android application that I want to be able to send requests
I want to be able to send e-mail from my own domain (Domain.com) over
I am trying to send data from an Android app to a PHP file
I want to send a couple of values to a web server from my
I would like my android app to be able to send some information to
I want to be able to send a simple http post from my firefox
I want to send a couple of values to a web server from my
I am able to send emails using the typical C# SMTP code across Exchange

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.