Ten en cuenta que en las ciencias informáticas cualquier problema casi siempre tiene varias soluciones, de igual modo nosotros aquí te mostraremos lo más óptimo y eficiente.
Solución:
StorageReference storageReference = FirebaseStorage.getInstance().getReferenceFromUrl("https://firebasestorage.googleapis.com/v0/b/***********************-5fac-45b6-bbda-ed4e8a3a62ab");
storageReference.delete().addOnSuccessListener(new OnSuccessListener()
@Override
public void onSuccess(Void aVoid)
// File deleted successfully
Log.e("firebasestorage", "onSuccess: deleted file");
).addOnFailureListener(new OnFailureListener()
@Override
public void onFailure(@NonNull Exception exception)
// Uh-oh, an error occurred!
Log.e("firebasestorage", "onFailure: did not delete file");
);
prueba esto lo he probado y funciona
String storageUrl = "Chat-Images/1498804025000.png";
StorageReference storageReference = FirebaseStorage.getInstance().getReference().child(storageUrl);
storageReference.delete().addOnSuccessListener(new OnSuccessListener()
@Override
public void onSuccess(Void aVoid)
// File deleted successfully
Log.d(TAG, "onSuccess: deleted file");
).addOnFailureListener(new OnFailureListener()
@Override
public void onFailure(@NonNull Exception exception)
// Uh-oh, an error occurred!
Log.d(TAG, "onFailure: did not delete file");
);
Fragmento para Eliminar archivo de Firebase Storage usando URL:
StorageReference storageReference = FirebaseStorage.getInstance().getReferenceFromUrl("https://firebasestorage.googleapis.com/v0/b/***********************-5fac-45b6-bbda-ed4e8a3a62ab");
storageReference.delete().addOnSuccessListener(new OnSuccessListener()
@Override
public void onSuccess(Void aVoid)
// File deleted
).addOnFailureListener(new OnFailureListener()
@Override
public void onFailure(@NonNull Exception exception)
// Error
);
Te mostramos comentarios y calificaciones
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)