我用firebase开发了一个社交媒体应用程序,但是当我尝试编译该应用程序时,我得到了getdownloadurl已过时的警告。我该怎么办才能解决这个问题?
Uri resultUri =result.getUri();
final StorageReference filePath = UserProfileImageRef.child(CurrentUserId + ".jpg");
filePath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
if(task.isSuccessful())
{
Toast.makeText(SetupActivity.this,"Profile Image Stored to Database Successfully",Toast.LENGTH_SHORT).show();
final String downloadUrl = task.getResult().getDownloadUrl.toString();
UsersRef.child("profileImage").setValue(downloadUrl).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful())
{
Intent selfIntent = new Intent(SetupActivity.this,SetupActivity.class);
startActivity(selfIntent);
Toast.makeText(SetupActivity.this, "Profile Image is Stored Successfully", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
else{
String message =task.getException().getMessage();
Toast.makeText(SetupActivity.this, "Error Occurred :" +message, Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
}
});
}
}
});`
`