Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).
  2. Server backend(Srv) which I want to connect to 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.

Base assumptions:

  1. I use android as a Mobile device
  2. Server is GAE
  3. Entity key in GAE is the user’s FB-id
  4. User Entity contains:
    1. User fb_id
    2. User verified list(FB_ID String)=> friends of the user that have the app) // maybe use HT?
    3. User statuses list(Status text, date, url)=> whatever I can get from a Status of a user in 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?
  4. How to Authenticate GAE with FB

Algorithm:

Android side:

 User login and get access token from FB
 Posting to my server(Srv) FB Token & myUserFBId // Should I use REST protocol or HTTP

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

like image 947
Elad Gelman Avatar asked Feb 28 '13 15:02

Elad Gelman


People also ask

How did you integrate the Facebook SDK in Android app?

To use the Facebook SDK in an Android Studio project, add the SDK as a build dependency and import the SDK. Go to Android Studio | New Project | Minimum SDK. Select API 15: Android 4.0. 3 (IceCreamSandwich) or higher and create your new project.

What is Facebook SDK used for?

The Facebook SDK is a set of software components that developers can include in their mobile app to understand how people use the app, run optimized marketing campaigns and enable Facebook login and social sharing.


2 Answers

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
  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..

like image 96
Its not blank Avatar answered Sep 29 '22 09:09

Its not blank


I'll give you my 4 cents:

  1. The questions that should lead you in developing the DS are: (A) On the server side, How does the data persist? 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? with an ORM? custom queries?
  2. About concurrency, you'll have to explain what's bugging you. People sign in to SO simultaneously all the time. 3/4. Not an android developer, can't help.
like image 27
Felix Avatar answered Sep 29 '22 09:09

Felix