i am sending username and password to php pages for authentication. want acknowledgement from php to android if password matched or not. username and passwords are saved in mysql database. php file is connected to mysql database.
If I'm not mistaken, when you are calling the php, you can get your result (validation) and echo it.
If the operation is long, you can use a queue structure, and check for your position in the queue and for it's results when executed.
If username and password are sending by the android app, so just read the result of your get or put request, your php page can send the result easily for you. but if another client is sending the username/password and android app is going to receive login data, there are two way
pulling: add a function in your php server to receive last login
data from database and call it in your android app, periodically.
Event base: add a socket server in your android app and send data from php
function to your android application by socket based on it's logging event, in this way you
receive the login event on time.
I do not recommend the second way, because it have some limitation and it's hard to implement in mobile platform, it needs android service and you must make sure that socket server is always running.
Related
Sorry if this is a silly question, I'm still a beginner in Android and couldn't find an answer to my question. I'm making an Android application that sends an input to a server and executes a Python script on that server to process the given input and generates an output. I was successful in sending data from Android client to Python server using SSH.
I can also use SSH to retrieve the output back to the Android client. However, the Python script takes some time to generate the output, and I can't seem to find a way for the Android client to wait for the Python script to finish generating the output. I was able to do this on internet connection with using Firebase database and have the Python script upload the output into Firebase database and have the Android client listen for changes in database. But I'm looking for a way to do this locally without internet (i.e. Firebase).
So is there a way to make my Android application wait for a message from Python to know it has finished with generating the output so it can retrieve it back using SSH or any other way?
Was a protocol what was send a code what was suppost to say if that 2 files are the same. but i do not remember the name. For u will be more easy to send the storage information's in bits (to the device) and after to start that important transfer. when the device will lost the connection will need to compare the real storage memory with the first information's send it and if has not match to ask the user to reconnect to internet or something like that. Maybe is helping until some one will give u the answer.
first off all sorry about the non-smooth english.
I have a problem with get data from user to my database or to string in my android java code.
I created website until now and i'm using my mobile as server.
In order to connect this site i turn the hotspot on and from a pc or other device i wrote the ip address with the port in the browser's address bar. for example, 192.160.42.1:8081.
My problem is that i have contact form in the site and i need the user will fill his details then i will get it in the android code (when he clicks send).
So can the user in the web click "send" and i will have a script that creates a new record in my Sqlite database? It will work for IE,Chrome,FireFox,Safary and android tablets browser? or i can pass string with his details from the contact form? (from the javascript to the java).
Notice that i dont have internet connection except the hotspot.
Bit unsure at what you are asking but if you just want to store the data locally then use an sqlite database from within your application, if you want to send data to an external website then in your code check for a internet connection and send a json string to your website and let a script there handle whatever you want to do with the data. If you dont have an internet connection then you could store the data in a sqlite database and send it when there is an connection.
I want to know the way to query a database to authenticate a user over network. I am not asking for any algorithm which is described in the posts like this Handling Password Authentication over a Network.
I have also taken a look at sync-adapter in android but I need authentication to be successful over the network before going ahead to Sync.
Here I explain it. I want to do so to avoid this problem.
I do not want a user to replicate GBs of data from server first and then authenticate in application db. I just that user will be authenticated over the network and then the data relevant to him only will be replicated(filtered replication)/synced on his device. So while authentication no data will be available on local device database.
Yes, What you can do is by using rest api there are few good libs avail for android.
Use those to send auth request and once it is authenticated on the server return true.
Once this done you query the server to get user data, then once you retrieve correct data form the server store it to your database, once stored get the the timestamp or the time and save it to ur database, and for the next time use this for query server if there are new record created in the server after this time stamp the return data or return nothing. so this will save your extra work.
Rather i would suggest you to implement google cloud messaging server on the server to notify.
Form more detailed architecture refer this tutorial :
http://developer.android.com/training/sync-adapters/index.html
http://developer.android.com/training/cloudsync/index.html
I am looking to send a facebook message from my application server without
the need to prompt the user for input each time.
I have been looking over the facebook chat API but it only works with facebook UI
which means that the user must be prompted every time I want to use the chat.
Is there a workaround or am I missing something?
I am using JAVA on my server.
I have a simple Friend System in PHP using a MySQL Database. I also have a Java application where a user can send a friend request to someone via the PHP system, and the recipient can accept it. When the user sends a friend request, the PHP writes the sender and the recipient's username into a table on the database, and right now in order to check for the friend request, the recipient has to manually refresh a PHP file (which outputs the sender's username).
I'm using HttpConnection to manually check the PHP file and load the output, but I am wondering if there is a way to constantly poll or keep an active connection that reads updated information from the PHP file so that the recipient can automatically be notified as soon as the sender sends a friend request instead of reloading the file every second (that doesn't use a whole lot of bandwidth).
Thanks.
You could use AJAX to keep checking instead of the user performing a hard refresh.
Other option would be using a webworker:
https://developer.mozilla.org/en-US/docs/DOM/Using_web_workers?redirectlocale=en-US&redirectslug=Using_web_workers
tkx