是否有解决方案,如何仅从Firebase存储(而不是android)中获取照片的链接?
我有-
nlmsg_alloc_size()
我可以上传照片
FileInputStream serviceaccount = new
FileInputStream("./serviceaccountKey.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceaccount))
.setStorageBucket("g-app-af0af.appspot.com")
.build();
FirebaseApp.initializeApp(options);
Bucket bucket = Storageclient.getInstance().
bucket("g-app-af0af.appspot.com");
我可以获得链接,但是它是临时的,我需要永恒的!!!
InputStream testFile = new FileInputStream("./12.png");
String blobString = "test_folder/" + "12.png";
Blob blob = bucket.create(blobString,testFile,"image/png",Bucket.BlobWriteOption.userProject("g-app-af0af"));
我可以删除并下载它很好
String bucketName = "g-app-af0af.appspot.com";
String blobName = "test_folder/12.png";
String keyPath = "./serviceaccountKey.json";
URL signedUrl = blob.getStorage().signUrl(BlobInfo.newBuilder(bucketName,blobName).build(),14,TimeUnit.SECONDS,Storage.SignUrlOption.signWith(ServiceaccountCredentials.fromStream(
new FileInputStream(keyPath))));
System.out.println(signedUrl);
但是我无法从存储中获得到照片的永久URL链接,嗯,原则上,作为一种选择,请指定100,000天 谢谢你的帮助
这样我就可以做到)