firebase-storage

How to return a boolean value when a file is successfully uploaded inside onSuccessListener?

爷,独闯天下 提交于 2021-02-01 05:18:28
问题 First look at this. I call a function uploadUserPdf() inside submitProfile() public void submitProfile() { if(!uploadUserPdf()) { return; } else { //............... } } And Here is the uploadUserPdf() function private boolean uploadUserBiodataPdf() { Uri fileUri = Uri.parse(Pdf); final StorageReference storageReference = FirebaseStorage.getInstance().getReference().child("Pictures"); StorageReference pdfRef = storageReference.child(mUser.getUid()).child(fileUri.getLastPathSegment()); pdfRef

How to return a boolean value when a file is successfully uploaded inside onSuccessListener?

。_饼干妹妹 提交于 2021-02-01 05:18:21
问题 First look at this. I call a function uploadUserPdf() inside submitProfile() public void submitProfile() { if(!uploadUserPdf()) { return; } else { //............... } } And Here is the uploadUserPdf() function private boolean uploadUserBiodataPdf() { Uri fileUri = Uri.parse(Pdf); final StorageReference storageReference = FirebaseStorage.getInstance().getReference().child("Pictures"); StorageReference pdfRef = storageReference.child(mUser.getUid()).child(fileUri.getLastPathSegment()); pdfRef

How to return a boolean value when a file is successfully uploaded inside onSuccessListener?

六月ゝ 毕业季﹏ 提交于 2021-02-01 05:16:22
问题 First look at this. I call a function uploadUserPdf() inside submitProfile() public void submitProfile() { if(!uploadUserPdf()) { return; } else { //............... } } And Here is the uploadUserPdf() function private boolean uploadUserBiodataPdf() { Uri fileUri = Uri.parse(Pdf); final StorageReference storageReference = FirebaseStorage.getInstance().getReference().child("Pictures"); StorageReference pdfRef = storageReference.child(mUser.getUid()).child(fileUri.getLastPathSegment()); pdfRef

how to properly initialize firebase app that can be used more than once?

浪尽此生 提交于 2021-01-29 22:21:09
问题 usually I initialize firebase in my activity just like this class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // usually initializing firebase just like this FirebaseApp.initializeApp(this) } but now I need that firebaseApp to be passed to get FirebaseStorage instance like this: // set firebase option val optionBuilder = FirebaseOptions.Builder() optionBuilder

how to properly initialize firebase app that can be used more than once?

一世执手 提交于 2021-01-29 21:59:00
问题 usually I initialize firebase in my activity just like this class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // usually initializing firebase just like this FirebaseApp.initializeApp(this) } but now I need that firebaseApp to be passed to get FirebaseStorage instance like this: // set firebase option val optionBuilder = FirebaseOptions.Builder() optionBuilder

how to properly initialize firebase app that can be used more than once?

£可爱£侵袭症+ 提交于 2021-01-29 20:09:37
问题 usually I initialize firebase in my activity just like this class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // usually initializing firebase just like this FirebaseApp.initializeApp(this) } but now I need that firebaseApp to be passed to get FirebaseStorage instance like this: // set firebase option val optionBuilder = FirebaseOptions.Builder() optionBuilder

Coroutines And Firebase: How to Implement Javascript-like Promise.all()

非 Y 不嫁゛ 提交于 2021-01-29 17:36:57
问题 In Javascript, you can start two (or more) asynchronous tasks simultaneously, wait both of them to finish and then do something/continue: const [firstReturn, secondReturn] = await Promise.all([ firstPromise, secondPromise ]; // Do something with first and second return. What I want to do in Kotlin (Android) is to start downloading two images from Firebase and when both downloads are completed - update the UI with them. So I have two Firebase async functions like this: FirebaseStorage

I have a problem to get video download url after upload to Firebase Cloud Storage in Android. getDownloadUrl is not working [duplicate]

南楼画角 提交于 2021-01-29 16:21:44
问题 This question already has answers here : How to use getdownloadurl in recent versions? (4 answers) How to get URL from Firebase Storage getDownloadURL (10 answers) Closed 10 months ago . I need this: I can upload video file successfully to Firebase Storage but I don't get the download url. Here is my upload code: Task<Uri> uriTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task)

Problem with Firestore database and storage

◇◆丶佛笑我妖孽 提交于 2021-01-29 15:54:56
问题 I am trying to save an image in storage, get the URL for that image and then stop the URL in a field in the database. The problem is that the image gets saved, but not the information for the document in the database, I have tried delaying the storage part but nothing works. I am not sure if the url is the issue or not, it seems if the image is already stored, then a re save of the document works. Here is my function: any help or guidance would be appreciated (I am a new to coding) @IBAction

Cannot store NSURL and __SwiftValue (Can only store objects of type NSNumber, NSString, NSDictionary) errors the bottom two blocks of code?

妖精的绣舞 提交于 2021-01-29 15:52:33
问题 So for the second last block(newImageRef.putData), I can define downloadURL as String?, but then I get __SwiftValue error at the last block (newImageRef.putData1). And even defining downloadURL as a string seems dangerous because looking at the documentation https://firebase.google.com/docs/reference/swift/firebasestorage/api/reference/Classes/StorageMetadata it seems to be used as a URL integral to the function. Other than these terminal error, there is a yellow error that warns Value