2014-04-16 17 views
1

我需要一個我的應用程序來更新我的服務器上的數據庫(喜歡,評論等...),我認爲唯一的辦法是讓機器人不斷更新它是通過使用戶創建一個帳戶,並通過Java要求在服務器端的PHP腳本來更新記錄,但我不知道如何讓應用程序瞭解用戶是否登錄或不...更新在線數據庫在Android中使用php會話

你有什麼想法可以幫助我嗎?謝謝

回答

2
In your user table add two extra column device id and token. when a 
user is logged in first time generate a random token and send it to 
the app and update your database.In app store that token in 
persistence. every time when app starts send that token to server if 
token matches with db token that means u r logged in, else not.for 
logout send null or zero to server. Try with this. 
+0

非常感謝您的幫助,我想到了這一點,但您幫助我弄清楚了一切,好的答案 – DomeWTF