We associate every parse user to their facebook ID as in the documentation.
ParseFacebookUtils.link(user, this, new SaveCallback()
However how is it possible to query the objects of a facebook friend using his facebook ID in Parse SDK Android?
This is only possible if you store the relationship information in Parse by associating the information with the user record. Even though Parse stores the facebook ID in the authData column, it is not queryable there.
You can get the facebook ID from the Graph API after user logs in (link) and store it as an additional column on the user record in Parse. When the user adds a friend, store this relationship in a table of your making. You can query that table to determine what the friend IDs are and access the appropriate data.
Alternately, if these queries only need to run while the user is currently logged in, you don't have to store the friend relationships. You can query the graph API (/me/friends) to get a list of friends of the user that are using your app. Facebook guarantees that they will return the same user IDs to your app each time.
Related
I am creating an application that would allow users to access data on their phones. Examples would be progress scores/test results.
I can upload the data to Firebase with an email address as the user link.
Is there a way that I can link this already loaded data to a user (with the same email address) once they have registered? Ideally using the email address in a rule to search up that data and use that reference point in the app.
Ideally I would like to pre-upload the users in bulk, but I know that Firebase only allows one user to be added at a time.
Any help would be appreciated.
After a user sign in to the app through the Firebase auth you can get its email through this call:
FirebaseAuth.getInstance().getCurrentUser().getEmail()
If you want to import data into your database, you should first make a json out of your data (list of users by email) and then use Firebase-Import to put it in your datastore.
I am developing a Firebase chat app.
I have implemented Firebase email/password authentication. So, when user signups successfully, I have a code through which on every signup/register the app stores user details like name,email, etc in Firebase database under uid node.
Then, the user searches for a friend using a email id,
if the uid with that email id is present in the firebase database, the function returns true,
then, the app, adds that email id under
<FirebaseApp>
<users>
....users details...
<friends>
<userid>
<unique pushed id> : searched email // here the friend's email id is added
After adding the new friend,
I am using a recyclerview to show the friend list.
So, the app retrieves all the nodes under friends>> current user's uid>>
As my database structure describes I have only saved friends uid in friends database.
At first step the user will have only friends' email ids. Let say in List friendsList.
Then I use this friendsList to retrieve all the other details of friends like profile picture, name, contact and etc... which is saved under users node.
But using for each loop retrieving the other details of every friend, and then store in a array list, then paasing that arrayList to adapter and then displaying to recyclerview. is a very time consuming process.
Becuase, it can have other functions too. like converting Base64 image to bitmap etc.
So every time activity starts , following all above steps, will make a lengthy process.
other that this, I have another way, where I can save friends other's details too under friends node. like name, contact etc. at a point when a new friend added to the database.
But again another question arises.
yes, I can store friend's other details too... But what if the friend updates his profile picture, contact?
So, this procedure is not suitable in my case.
How can I create a whatsapp like friends list in my Firebase app, where I every user's friends list will be always updated with his/her friends details.
also, the will not go under any lengthy process.
The best approach is to save all the necessary details in the friends node as well.
You can just save the Opposite_Friends tag in each user, where just add all the uids in whose friends list user is present, So that whenever user updates any detail, you can update it in every users Friends node as well.
I am currently making an Android app that allows Facebook sign-in and for each user, stores their email address (from Facebook) along with a couple integer variables in my database.
Upon login, I want my app to check if my database contains the email address of the logged on user. If it does, I proceed with the app functionality, if not, I create a new entry in my database for that user, with an email address and the associated integers.
How can I formulate a query or request that searches my database for a given email string? I am not very experienced with Firebase.
Using FirebaseAuth for your Facebook sign-in would give every user a unique id generated by Firebase.
This id is returned to you in the code when login is successful. You could then retrieve the user's email from the returned object.
Assuming you're using Firebase's real time database to store your info, you could check out their official docs here on how to use your DatabaseReference DataSnapshot to query the database
I'm making an application for android which is used to store profile information of a user( FirstName, LastName, Email, Username, Password ). It will also store profile picture of the person. You can think of applications like WhatsApp, Viber Tango. There are many more like it.
In order to store and access this information easily and efficiently, how should these information be stored? I'm thinking about storing this information in Relational Database like MySql. I will have FN,LN,Email,Username, password and link to profile picture as columns of table. One more issue I had in mind is that if a user has say 100 friends, should I create a new table per user so that all his/her friends can be separate and accessed from single table or I should run some complex SQL query so that it returns list of friends of user?
Thanks a lot
I believe you are on the right track. MySQL is a fine choice for storing the data as long as it is on a server that can be accessed by your application.
You will need 2 tables: one to store all of the users and another to map the users friends.
Your users table will be pretty straight forward as you have already laid out. The other table (could be named something like user_friends) would have a column containing the id of the friend that made the request, another column containing the id of the friend that accepted the request, and any other x amount of columns you may need to contain information about the friendship. Any record without an id for the accepted friend can be displayed as a pending request.
I would make sure that there can only be one record containing a mapping of friends to prevent duplicates as well.
I am creating an app which is related to get the images from flickr but in this by passing user id we will get the images from a particular account with providing user id manually.
but i required the user id when user login with username and password.
how can get user id by passing username and password?
Your formulation is not really clear, but if what you are asking is how to get the user ID from the user name, since flickr uses OAuth; a quick look at the api documentation can give you the query you need to use:
lookupuser seems useful or
findbyusername
the first one gives you the id corresponding to an user url, the second one the id corresponding to an username.
You just have to parse the response to get the id (unless flickr provides a wrapper that does the parsing for you but it does not seem to be the case:)