我正在使用firebase应用程序我下载文件,但我找不到它在存储上的路径
try {
localFile = File.createTempFile("pdf", "pdf");
} catch (IOException e) {
Toast.makeText(this, "failed", Toast.LENGTH_SHORT).show();
}
final String parent = getIntent().getStringExtra("type").toString();
final String ch = getIntent().getStringExtra("value").toString();
mRoot = FirebaseDatabase.getInstance().getReference().child(parent).child(ch);
mRoot.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
text = dataSnapshot.getValue(String.class);
name = text;
Toast.makeText(pdf.this, name, Toast.LENGTH_SHORT).show();
s = FirebaseStorage.getInstance().getReference().child("pdf").child(name);
s.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(pdf.this, "loading", Toast.LENGTH_SHORT).show();
pdfView.fromFile(localFile);
Toast.makeText(pdf.this, "Done", Toast.LENGTH_SHORT).show();
// Local temp file has been created
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
Toast.makeText(pdf.this, "failed", Toast.LENGTH_SHORT).show();
}
});
}
我可以使用什么工具在手机上下载文件网址,如何在不使用android pdf查看器下载后打开pdf文件,因为它无法正常工作