我只是Google Firebase中的新手。我加载了一些音频文件,我希望从我的应用程序访问它,以便在流中听到它。我有一些麻烦。我做了一个参考,但如果我想这样做 - 我有404错误。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
storage = FirebaseStorage.getInstance();
storageRef = storage.getReferenceFromUrl("gs://musicmedia-f3b8d.appspot.com");
audioRef = storageRef.child("audio");
final List<FileDownloadTask> tasks = audioRef.getActiveDownloadTasks();
for(FileDownloadTask task: tasks){
names.add(task.getSnapshot().toString());
}
audioRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Toast.makeText(getBaseContext(), audioRef.getPath(),Toast.LENGTH_LONG).show();
Log.d("Tag",audioRef.getName());
for (int i = 0; i < tasks.size(); i++) {
System.out.println(names.get(i).toString());
}
}
});
}
你能帮我吗?