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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:30:29+00:00 2026-06-01T20:30:29+00:00

I am trying to create and Android app that requires the user to be

  • 0

I am trying to create and Android app that requires the user to be authenticated (through a REST web service). The app has multiple activities and screens that all require the user to be logged in, when logged in the user can add and edit posts on a website.

I have read that using a AndroidHttp Client within a “ConnectionManager” singleton would be the best way to do it. However where would I go about storing the users details (username, password), would this be in the singleton? Should I authenticate each time the user try’s to edit/add something?

Should I have a class like this:

public class ConnectionManager {

    private static ConnectionManager instance = null;
    private AndroidHttpClient client;

    private ConnectionManager() {
        client = AndroidHttpClient.newInstance("Android-Connection-Manager");
    }

    public static ConnectionManager getInstance() {
        if( instance == null ) {
            instance = new ConnectionManager();
        }
        return instance;
    }

    public void authenticate(String username, String password) {
        //Check for authentication here
    }
}

and call the below code every time the user does something:

private static ConnectionManager conn = ConnectionManager.getInstance();
conn.authenticate();

OR

should I store the users details in the singleton

public class ConnectionManager {

    private static ConnectionManager instance = null;
    private AndroidHttpClient client;

    private AppUser mLoggedInUser;
    private boolean mAuthenticated;

    private ConnectionManager() {
        client = AndroidHttpClient.newInstance("Android-Connection-Manager");
    }

    public static ConnectionManager getInstance() {
        if( instance == null ) {
            instance = new ConnectionManager();
        }
        return instance;
    }

    public void InitialiseUser(String username, String password) {
            //Do login checks here then return true if logged in
            mAuthenticated = true;
    }

    public boolean isAuthenticated() {
            return mAuthenticated;
    }
}
  • 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-06-01T20:30:30+00:00Added an answer on June 1, 2026 at 8:30 pm

    If you have control of the Rest Service, you could authenticate using the username\password on the initial connection and then return a “token” to your app if authentication succeeds.

    Your app could then add this token to the http headers of all future requests and your service could check that it is valid before proceeding.

    That is how I did it and it works well.

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

Sidebar

Related Questions

I am trying to create an android app which will show multiple web urls
I'm trying to create an app that allows the user to open the android
I am trying to create an android app that will connect to various web
Just started playing with Android and I'm trying to create an app that has
I'm trying to create an Android client for a client/server app that has previously
I'm trying to create an app for Android that simply sends a command to
I am trying to create a simple Android application that has a ActivityList of
I'm trying to create an Android app that adds a random quote to images.
I am trying to create an android app that communicates with a local server
I'm trying to create an Android app that searches for a certain type of

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.