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

  • Home
  • SEARCH
  • 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 8588453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:48:21+00:00 2026-06-11T22:48:21+00:00

What is the best way to write an android application that logs into a

  • 0

What is the best way to write an android application that logs into a server? I am thinking I do not want to maintain a socket, so I think I want to avoid that, I think I want to use the http protocol. My question with that is, on the server side, ideally I would like to use PHP to handle the GET/POST calls from the android app, but I don’t know how to return (using PHP) information that my app can handle and not just an html file.

So for example, the facebook app for android. When you first download the app, you login and then the app maintains your connection, but obviously the app is not another web browser, but a regular app that presents its information as if it were a web site. How does the app pass the session cookie so that the PHP $_SESSION variables maintain themselves? How does the android app handle the data that comes back?

If I send a get requestion to htt://www.test.php can the PHP code that executes on the server return a custom set of data? Will the $_SESSION variables be automatically maintainted?

Thank you

  • 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-11T22:48:23+00:00Added an answer on June 11, 2026 at 10:48 pm

    You can send a get/post request to log on the server. The PHP page can return JSON or XML. Then your Java (Android) code will have to parse that response.

    You can have the PHP page log first, and then start a session. Maybe generate a token key and store this in the database, and then return this to the android app. Android app will get this token (after parsing), and probably save it in a preferences file. This approach is basically a custom session. You will have to figure out things like expiration of token, etc.

    There might be a way to store PHP sessions, but not sure how an app behaves differently from a browser. I think sessions can be little bit more complicated with apps.

    More discussion here: php session destroyed in android application

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

Sidebar

Related Questions

What is the best way to write a function (or something DSLish) that will
What's the best way to write an application in order to get it working
In Android, what is the best way to write to the console. In C#
What is the best way to write a class based view that both shows
I want to know what is the best way to write in the URL.py
What is the best way to write minimal error logs in an ASP.NET 2.0
What would be the best way to write some values into a xml file?
I'm trying to write an android application that has two main activities: login screen
I am in need to write an application for Android devices that needs to
What's the best way to write a LINQ query that inserts a record and

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.