6
Android的Facebook應用程序的整合,我想怎麼解決的下一個問題:
與GAE
- 一個Android應用程序,我想連接到Facebook,併到後端服務器(SRV)。
- 我想連接到Facebook的服務器後端(Srv)。
- 服務器將運行將獲取用戶的所有朋友(fb)和用戶狀態(fb)的任務,並將它們存儲在其上。
基本假設:
- 我使用Android作爲移動設備
- 服務器是GAE
在GAE- 實體密鑰是用戶的FB-ID
- 用戶實體包含:
- 用戶fb_id
- 用戶已驗證列表(FB_ID String)=>擁有該應用的用戶的朋友)//可能使用HT?
- 用戶狀態列表(狀態文本,日期,URL)=>什麼我可以從一個用戶的Facebook上的狀態得到..
主要問題:
- 數據表達是否被想到了?它會更好嗎?
- 如何處理兩個互相連接的用戶同時添加應用程序的情況 - 我如何避免重疊?
- 設備是否應該對GAE服務器進行身份驗證?
- 如何使用FB
算法驗證GAE:
Android的一面:
User login and get access token from FB
Posting to my server(Srv) FB Token & myUserFBId // Should I use REST protocol or HTTP
POST?
服務器端:
A Servlet handles the POST
{
Query FB ->for the user's friends ids(into friendList = arrayList<FBItem))
foreach FBItem item in friendList
{
//check which FB-ids are in my DB
friendEntity = getKey(item.fb_id)
if(friendEntity != null)
{
// friend exists
verifiedFriendsList.add(item.fb_id) //verifiedFriendsList is ArrayList<String>
friendEntity.getVerifiedFriendList().add(myUserFBId)
}
}
Query FB ->for the user's statuses(into statuses = arrayList<StatusItem))
add new FBEntity(myUserFBId, verifiedFriendsList, statuses) to DB }
感謝