I am working on an android app that interacts with facebook places.I have the users place list(checkins,status) and the users's friends list.I also have the place list for each of the user's friends.I would like if its possible to query facebook for the common places that the user has with each of his friends.
Does anyone know if it is possible?
I just found this:
https://developers.facebook.com/docs/reference/api/checkin/
With Checkin you can query the where a user and a place interact.
I found this problem before (one year ago), but I was crawling posts and comments. These posts and comments have the place parameter (see this here), so you can take the last one associated to the user to be the current location or so.
Related
I'm using FirebaseRecyclerAdapter to show posts. But I don't want to show all the posts. I just want to show posts which are posted by current user's friends.
Current User's friends in Realtime Database is stored in this way:
And Every post is stored with the uid of User who posted it, in following way:
So, what will be the efficient way to retrieve posts from only current user's friends.
Solution for this issue is use FirebaseIndexRecyclerAdapter instead of FirebaseRecyclerAdapter.
Link: https://github.com/firebase/FirebaseUI-Android/blob/master/database/README.md#using-firebaseui-with-indexed-data
Step by Step:
First-> maintain post of every user in a node let say "My_Challenges":
So whenever a user post anything, copy that post id under user uid inside this node too.
Second-> Maintain another node for posts which you can see(in my case i want to see only my friends posts) let say "timelineIndex":
Let say User 1(1014382358695053) and User 2(10207254337991322) are friend. So copy all post id from My_Challenges of User 1 to timelineIndex of User 2 and vice versa also. (NOTE : You have to do this every time a new post id comes under your uid copy it to your friend uid under timelineIndex)
Finally-> Use FirebaseIndexRecyclerAdapter :
As in above given link, use
keyRef = databaseReference.child("timelineIndex").child(mUserId);
dataRef = databaseReference.child("Blogs");
That's it. I hope it helps.
To prevent people from seeing the posts you should use some method of authentication. This way the only people that can see the posts are the people who are logged in.
Firebase one to one messaging is not directly supported as stated in this previous question:
How to send one to one message using Firebase Messaging
I am building a social app, I have a database on firebase that is structured like this:
tJWRbfqUUbSQn5eI8ZS5vPG9znr1
bio:
coverPhotoUrl:
email:
firstname:
imgUrl:
lastname:
name:
phone:
posts
-KPN0b7QmNp8AjYy4yFl
-KPXmtvZdiQ--QjZ-j3m
-KPc7PpDkmFNU9JjlIJP
-KPc7PptOulQdrpsrGEp
-KPc7Pq6JC7bjt8-sRFU
-KPc7PqJ2651EIQWXIv6
the top level key is th user id, so i have that for every user, each user has posts too, inside the posts node, i have comments, pushed in the exact the same way as posts.
My question is that I am a bit curious about how i am going to model a Newsfeed, right now A Newsfeed to me is a list of posts from you and your everyone you are following in the exact order of the time they were posted while a timeline is just posts from the said user in that order too.
I have correctly done the timeline by just iterating over posts from the user
I have tried to do the Newsfeed part in two ways, which has bugs and I think is not very efficient
Since every user maintains a list of his followers in his own node, i made it such that anytime a user makes a post, he not only writes in his own 'posts node' but also in every other person following him's 'Newsfeed' node
Cons of this method
a. in the event of an unfollow, i am not able to remove user A's posts from User B's timeline
b. i am giving every user access to write in every other person's node, which as i have read, is not a very good practice.
Maintain the url of User A's post node in user B's Timeline node, which would solve the con B of method 1.
Cons of this method
a. I dont know how to implement it.
I dont know if there is any textbook way to do this(of course there has to be, there is only so much social network platforms out there), if there is i want to know, also if you could point me to how(not help me to) implement my method 2, i will very much appreciate it.
Also, i was following this similar question
which does not completely answer my question but looks like a very interesting approach
I think the solution you are looking for is referred to as client-side fan-out. This Firebase Blog post provides a great explanation and will point you in the right direction.
Client-side fan-out for data consistency
It looks like you need a new datastructure for keeping score who is following who. Use that information to build your newsfeed. That way there is no need for one user to write "into" another user. Every posting is only stored once for the user why created the post. If the follow and unfollow changes, you can simply recalculate on the fly which posts to include in a newsfeed
I integrate my android app with facebook. I want to fetch (then display) list of my facebook group on my app. Maybe anyone have a tutorial to do that?
What you are looking for is the following end point
/me/groups
Which displays the list of the groups the User has subscribed to. But to get the data from the end point you will be required to obtain the user_groups permission to read the User's group.
You can see the documentation at:
https://developers.facebook.com/docs/reference/api/group/
I want to display my facebook online friends and offline friends suppurate.But i don't know how to display.But I am getting all my facebook friends into list in my application.
Any one please help me.....How to display online and offline friends suppurate.
First - use the fb api. get the friends.
Second - show the list in beautiful Ui component or what ever.
So I understand that you have done the first, right?
If so, then what stops you to make some container and push back dynamically to it labels for example. After this you can try some more beautiful solution how I sad..
try explain more what you've done... Be more specific, please. :)
EDIT 1
Here you are: https://developers.facebook.com/docs/reference/fql/user
Use that:
online_presence
The user's Facebook Chat status. Returns a string, one of active,
idle, offline, or error (when Facebook can't determine presence
information on the server side). The query does not return the user's
Facebook Chat status when that information is restricted for privacy
reasons
EDIT 2
May be you need a loop all your friends and for each of them execute the query
SELECT online_presence FROM user WHERE username = the_friend_from_list
This is a pseudocode but I'm sure you can handle it. :)
I would like to search facebook user by thier name. For example, If I type 'James',
I would like to return facebook users whose name is 'James'.
I know it is possible to access user's info with user's id value. But is it possible to access
user's id with only user's first name or last name?
Sergey is right about the fact that searching for all people named James would be useless. Sergey is referring to FQL, which is a different way of querying data, but as DMCS pointed out, there is a search function in the Graph API that can enable you to do what you're trying to do.
https://developers.facebook.com/docs/reference/api/
I quote:
Searching
You can search over all public objects in the social graph with https://graph.facebook.com/search. The format is:
https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE
If you go to the page, there will be some examples of URL queries you can use to search for different types of objects, including users.
In my view, a useful application will typically be operating in the context of a FB user, accessing the objects that user has given the application permission to access. If you're searching a name among a user's friends, it's probably easiest to get all of his friends (you don't need any IDs to do this, other than the logged in user), and parse through that list for the user's name and ID, and then use the ID to get whatever information you're going to get.
It's really simple, do an HTTP GET to the Graph API search?q=James&type=user&access_token={token}
Take a look at this table https://developers.facebook.com/docs/reference/fql/user/
there're certain restrictions applied to that and required fields in the query because there can be millions of 'Jameses' and you will overload facebook's services with your queries as simple as that. They will not give you all the Jamses due to security and load reasons.