Android Authentication Constantly with External Server

1

People would like to know how to make the application that I'm developing authenticate constantly.

For example, watts if you do not have internet access and try to send a message it stays saved and the app is constantly trying to send this message and when you have internet access again, message to server immediately.

In my case my app will have a desktop version of this form I will use the server to synchronize the user information between the two devices, for example the user accesses with his login the Android app and changes his profile image gives the app update this image locally and then send it to the server and when the user opens the desktop version app he downloads this server update and vice versa.

Does anyone know how to do this? I'm using wampserver + php.

    
asked by anonymous 23.12.2015 / 04:30

2 answers

0

Well with my searches I found a way that at first I found an exaggeration for a simple task, but since I did not find any other better way then I will use this one. I'm going to use the Sync Adapter class along with others I've seen in the Android documentation, which I read through this constant check of the connection to the server, so the link to who needs it:

link

Thanks for the previous reply @Alessandro Barreto.

    
02.01.2016 / 00:18
0

It's all about the logic of the programmer.
I would do it like this: example of whatsapp messages you mentioned. I would create a column in my table called STATUS , in it I would save the following information:
0-message not sent
1-message sent Home If at the time the user typed the message, sent the internet ) save with status 1 Otherwise ( saved with status 0, because the message was not sent ) following. Home Any time the user opens the application and is on the internet or the app is closed and a BroadcastReceiver detects the internet presence, it would make a select on all messages with status 0 messages that have not been sent ) and since you are now going to have the internet to send the message (following the business rule 'just send message if you are connected to the internet') would update the messages to status 1 ( which symbolizes the messages sent successfully )

    
23.12.2015 / 05:43