0
\$\begingroup\$

Recently for my new game i am implementing the Facebook Login. Currently when i login i show the Profile image to the user.

void UpdateUserNameAndImage(bool isLoggedIn) {
    if (isLoggedIn) {
        FB.API ("/me?fields=first_name", HttpMethod.GET, UpdateUserName);
        FB.API ("/me/picture?type=square&height=50&width=50", HttpMethod.GET, UpdateProfileImage);
    } else {

    }
}


private void UpdateProfileImage(IGraphResult result) {
    if(result.Texture != null) {
        facebookLogin_button.GetComponentInChildren<RawImage> ().texture = result.Texture;
    }

}

The code is normal. I call it after there is successful login from the user.

The problem: Well the problem is that there should be internet for the profile picture to appear. There must be a call made to the graph api for the image everytime.

I want to show the profile image of the user when there is no internet too.

So i am looking for some kind of cache that Facebook SDK use for the logged in profile that i am not aware of.

\$\endgroup\$
  • \$\begingroup\$ Can you show us your UpdateProfileImage callback? \$\endgroup\$ – DMGregory Jul 2 '17 at 16:12
  • \$\begingroup\$ It looks like you get access to a texture. Is there anything preventing you from saving that texture to disc to load as a fallback next time? (Including any Facebook policies - I know some services have rules against caching personally identifiable data about users, but I don't know Facebook's policy in particular) \$\endgroup\$ – DMGregory Jul 2 '17 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.