Я недавно только что заметил, что мое изображение профиля не загружается и в моей базе данных написано "https://platform -lookaside.fbsbx.com / platform / profilepic /? Asid = 3143323662344523 & height = 200 & width = 200 & ext = 1566545362 & hash = AeS-asAF_-qCWALi"Может кто-нибудь помочь мне? это будет огромная помощь. спасибо
ниже мой код
public void getUserDetailsFromFb (AccessToken accessToken) {
GraphRequest req = GraphRequest.newMeRequest(accessToken, new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(final JSONObject object, GraphResponse response) {
try {
Log.d("response101", String.valueOf(response));
if (object.has("email")) {
mEmail = object.getString("email");
} else {
mEmail = "";
}
mPhotoUrl = object.getJSONObject("picture").getJSONObject("data").getString("url");
mId = object.getString("id");
mName = object.getString("name");
mUser = new User();
mUser.setiD(mId.toString());
mUser.setFirstName(mName.replace(mName.substring(mName.lastIndexOf(" ")), ""));
mUser.setLastName(mName.substring(mName.lastIndexOf(" ")).replace(" ", ""));
mUser.setEmail(mEmail);
mUser.setPhotoUrl(mPhotoUrl);
AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
mAuth.signInWithCredential(credential)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
//check if user already exists; if yes, proceed to userMainActivity
databaseUser.child(mUser.getiD()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()){
//we don't need the whole user object just the userId
Log.d(TAG,"iddd: " + mUser.getiD());
startActivity(new Intent(LoginActivity.this, UserMainActivity.class).putExtra("userId", mUser.getiD()));
} else {
startActivity(new Intent(LoginActivity.this, EditProfileActivity.class).putExtra("user", mUser));
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(LoginActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "graph request error : " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender,birthday,picture.type(large)");
req.setParameters(parameters);
req.executeAsync();
}