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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:30:12+00:00 2026-06-16T07:30:12+00:00

After login in android app, how do I create a token session in the

  • 0

After login in android app, how do I create a token session in the php api?

Like this:

I would like to make sure that when user log in it will stay in session no matter what happens (crashed, shut down/power down/reboot, leaving the app) at same time the user info data will be sending with all the activities in the app to the webserver.

Do I simply use:

session_start();
$_SESSION['username'] = $user;
$_SESSION['auth'] = "true";

If so how do I pass this session into the android application?

Login Authentification in Android App:

HttpClient client = new DefaultHttpClient();
String url = "http://www.somewebsite.com/login.php?username="+username+"&password="+password;
HttpGet request = new HttpGet(url);
// Get the response
ResponseHandler<String> responseHandler = new BasicResponseHandler();
response_str = client.execute(request, responseHandler);
php android authentication login session-cookies
  • 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-16T07:30:14+00:00Added an answer on June 16, 2026 at 7:30 am
    • When your Android application first calls your Login API, retrieve the token fields from the validated response
    • Store these token fields locally, in the app, using SharedPreferences

    http://developer.android.com/reference/android/content/SharedPreferences.html

    • (this storage persists outside of the app/os lifecycle, it will still be there after a relaunch of the app or device reboot)
    • Whenever you call your web service (php), append the token parameters

    This looks like some relevant information here:

    http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/

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

Sidebar

Related Questions

I would like to make sure that when user log in it will stay
I am developing an Android App that integrates with Facebook. I would like to:
I created a login activity for my Android app. After the user enters the
I'm coding an android app that sometimes uses php scripts and I'm now trying
I'm developing an Android app with Foursquare API. As stated here , after a
After login Facebook in my own Android App(use Facebook SDK), already the obtained access
i have created one login and register view in that view after login user
I need to launch an app I've made just after login, before anything else
Am using django social-auth authentication for my app.After login to facebook or twitter from
I am with some trouble in Django... After login I am losing auth session

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.