简体   繁体   English

Android Facebook应用程序与GAE集成

[英]Android Facebook app integration with GAE

I'm thinking about how to solve the next problem: 我正在考虑如何解决下一个问题:

  1. An Android App which I want to connect to facebook, and to a Server backend(Srv). 我想要连接到Facebook和服务器后端(Srv)的Android应用程序。
  2. Server backend(Srv) which I want to connect to facebook. 服务器后端(Srv),我想连接到Facebook。
  3. The server will run a task that will Get all the Friends of the user(on fb), and the user Statuses(on Fb), and store them on it. 服务器将运行一个任务,该任务将获取用户的所有好友(在fb上)和用户状态(在Fb上),并将它们存储在其上。

Base assumptions: 基本假设:

  1. I use android as a Mobile device 我使用android作为移动设备
  2. Server is GAE 服务器是GAE
  3. Entity key in GAE is the user's FB-id GAE中的实体键是用户的FB-id
  4. User Entity contains: 用户实体包含:
    1. User fb_id 用户fb_id
    2. User verified list(FB_ID String)=> friends of the user that have the app) // maybe use HT? 用户验证列表(FB_ID字符串)=>拥有该应用程序的用户的朋友//可能使用HT?
    3. User statuses list(Status text, date, url)=> whatever I can get from a Status of a user in facebook.. 用户状态列表(状态文本,日期,网址)=>我可以从Facebook的用户状态获得的任何内容..

Main questions: 主要问题:

  1. Is the Data representation thought out? 是否考虑了数据表示? can it be better? 会更好吗?
  2. How do I handle a situation where two users which are connected to one another add the app at the same time- how can I avoid overlapping? 如何处理两个相互连接的用户同时添加应用程序的情况 - 如何避免重叠?
  3. Should the device Authenticate itself, also with the GAE server? 设备是否应该使用GAE服务器进行身份验证?
  4. How to Authenticate GAE with FB 如何用FB验证GAE

Algorithm: 算法:

Android side: 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? POST?

Server side: 服务器端:

  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    }

Thanks 谢谢

I have not done anything like this but I think you will need to 我没有做过这样的事情,但我认为你需要这样做

  1. Ask user to authenticate your application to use FB- Read about OAuth Api of Facebook 要求用户验证您的应用程序以使用FB-阅读关于Facebook的OAuth Api
  2. Once your app is authenticated with sufficient permissions you can get users data as per your requirements . 一旦您的应用通过足够的权限进行身份验证,您就可以根据您的要求获取用户数据。
  3. Once you get the data you can process it. 获得数据后,您可以处理它。

Oauth on FB is what you are searching for.. FB上的Oauth就是你要找的......

I'll give you my 4 cents: 我给你4美分:

  1. The questions that should lead you in developing the DS are: (A) On the server side, How does the data persist? 应该引导您开发DS的问题是:(A)在服务器端,数据如何持续存在? to a File? 到文件? to a Database? 到数据库? (B) How much of that data is required to perform the calculations you want done, and how do plan to access it (for example, for an O(n) run, I wouldn't use a HashTable) (C) How does the persist / de-persist work? (B)执行您想要完成的计算需要多少数据,以及如何计划访问它(例如,对于O(n)运行,我不会使用HashTable)(C)如何持续/去坚持工作? with an ORM? 用ORM? custom queries? 自定义查询?
  2. About concurrency, you'll have to explain what's bugging you. 关于并发性,你必须解释什么在困扰你。 People sign in to SO simultaneously all the time. 人们一直同时登录SO。 3/4. 3/4。 Not an android developer, can't help. 不是android开发者,也无济于事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM