I have been going through the tutorials on using the Facebook Android SDK.
I noticed that it makes the asynchronous request to get the info whenever the onCreateView is called:
Session session = Session.getActiveSession(); if (session != null && session.isOpened()) { // Get the user's data makeMeRequest(session); }
So whenever a configuration change is made (orientation) or it create the fragment navigating back from another activity it makes the request.
I think that this is a waste of network usage and time as all I need is the profile picture, name and email. These values do not usually change very frequently.
I think one way is to make the request once each time an authenticated user opens the app. Then cache the data or use SharedPreferences from that point onwards.
I am storing one image and two text fields.
How should I do this?
0 comments:
Post a Comment