I'm thinking about how to solve the next problem:
- An Android App which I want to connect to facebook, and to a Server backend(Srv).
- Server backend(Srv) which I want to connect to facebook.
- 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:
- I use android as a Mobile device
- Server is GAE
- Entity key in GAE is the user’s FB-id
- User Entity contains:
- User fb_id
- User verified list(FB_ID String)=> friends of the user that have the app) // maybe use HT?
- User statuses list(Status text, date, url)=> whatever I can get from a Status of a user in facebook..
Main questions:
- Is the Data representation thought out? can it be better?
- 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?
- Should the device Authenticate itself, also with the GAE server?
- 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
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.
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.
I have not done anything like this but I think you will need to
Oauth on FB is what you are searching for..
I'll give you my 4 cents:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With