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 7549941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:05:07+00:00 2026-05-30T10:05:07+00:00

I have set up the code to call a remote server from Android app

  • 0

I have set up the code to call a remote server from Android app to a remote server. Here is the code:

private class DownloadWebPageTask extends AsyncTask<String, Void, String> 
{
        @Override
        protected String doInBackground(String... theParams) 
        {
            Log.d( "Inner class: " , "Doing stuff in background" );

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

        Log.d( "Inner myURL: " , myUrl );
        Log.d( "myEmail: " , myEmail );
        Log.d( "myPass: " , myPassword );

        ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();  
        postParameters.add(new BasicNameValuePair("username", myEmail ));  
        postParameters.add(new BasicNameValuePair("password", myPassword ));            

        String response = "";

        DefaultHttpClient client = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(myUrl);

        try 
        {
                HttpResponse execute = client.execute(httpGet);
                InputStream content = execute.getEntity().getContent();

                BufferedReader buffer = new BufferedReader(
                        new InputStreamReader(content));
                String s = "";
                while ((s = buffer.readLine()) != null) 
                {
                    response += s;
                }

                Log.d( "After call, response: " , " " + response);
            } 
            catch (Exception e) 
            {
                Log.d( "Exception: " , "Yup");
                e.printStackTrace();
            }

        return response;
    }


    @Override
    protected void onPostExecute(String result) 
    {
        Log.d( "Post execute: " , "In the post-execute method" );
        //textView.setText(result);

        if ( result != null && result == "Ok")
        {
            Log.d( "Post execute: " , "OKKKK :)" );       

        }
        else
        {
            Log.d( "Post execute: " , "NOOOT  OKKKK :)" );              
        }
}    

}

This is a request to be authenticated and logged in. Right now as you can see, I am collecting a login and password from the user, but not sure how to best attach that to the request URL.

I can just do something like urlString + “?login=login&pass=pass but I was wondering whether there is a “good practice” way of doing this in the Android environment? Also, my url is not htpps – is there a way to make it secure?

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-30T10:05:09+00:00Added an answer on May 30, 2026 at 10:05 am

    This is not secure. Your URL is passed through the internet most likely through several hops unencrypted. It is trivially simple to sniff these requests. The simplest way is to send this data in the message body using HttpPost and use HTTPS. If you must use HTTP, try digest authentication explained here: how to use Digest authentication in android?

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

Sidebar

Related Questions

I currently have my code set to disable the submit button when the field
I am having a bit of difficulty with this current code I have set
Anyone have code to set margins(top,left,right,bottom) using excel interop and vb.net. I think it
I have the following code set up in my Startup IDictionary<string, string> properties =
I have a problem with this is code: Set oXmlHTTP = CreateObject(Microsoft.XMLHTTP) oXmlHTTP.Open POST,
I have a View with ViewModel as datacontext ( set in code) . In
I have the following code to set a userId variable: (userId set in prior
I have java script code to set some of the properties of ajax controls.
I currently have CruiseControl.NET set up with SVN to automatically grab the code source
I have some code that produces a set of primary key values that I

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.