We help IT Professionals succeed at work.

android - login page

GlobaLevel asked
I have an android login page on my smartphone and I need to connect to the db and return back to the phone wherther they have successfully logged on or not....any ideas...
Watch Question

The best and most common way would be to use a webservice you can call from your device. Maybe written in php. Here is a nice tutorial explaining exactly how to do this.

But don't forget to think also about some security aspects like sql-injection, encrypting the data sent between the layers, how to store sensitive (user) data in the database, etc.

If you are using the db (sqllite) in the same application, then you may do it with simple database connection logic found in many articles around.

If you would like to connect to the database on any webserver over internet, then the best way is to use webservices. You may write code to receive a response from the webservice and know whether the connection was succesful.

Please let me know if need more clarifications. Also, if possible elaborate your question in detail.


yes okay I like the web service adn I have one existing and it works so i can use that it is written in vb.net....

I really need two web services....one for the login....where I can send a useranem and password voer the WS and it return if the query has found their creds on the DB...if so route to another page...if not then send a message via textview that the username and password was not found...I dont have  SQLlite inside the app...

so I was curious if there is any code that is existing that I could use for this purpose.. that I could drop ito my app. thanks
The only thing you need to handle is the way you communicate with the database. So of course you can use your existing .net-webservice. It doesn't matter if it is written in php, .net, jsp, etc.
The android device sends a request to the webservice by an http-request. The webservice handles the request and sends back a response. Your android app must handle the response. That's all.

In your case:
1. android app: send username/password by http request.
2. webservice: get the data, verify it with the database-data, send success-/failed-response
3. android app: process response from the server, show success-/failed-message

Of course you can use a second (and mostly some more) "service" to do more, for instance when login was sucessfull but the way of doing it stays the same:

So there are a lot of tutorials doing this. Surely you can snip out some code somewhere... But it always depends on the webservice and your app.


Okay I used some code on the internet...but the issue...I'm having now is that...I'm getting alot of undefined errors, like soapobject undefined....its like I need to impot a DLL or somethinb