[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request - Firebase Storage SDK: Natively add mobile prefixes when uploading file via Android/iOS build #684

Open
bryanlands opened this issue May 19, 2020 · 1 comment

Comments

@bryanlands
Copy link

Please fill in the following fields:

Unity editor version: 2019.3.2f1 Personal
Firebase Unity SDK version: 6.11.0
Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage
Firebase plugins in use (Auth, Database, etc.): Auth, Database, Messaging, Storage
Additional SDKs you are using (Facebook, AdMob, etc.):
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): Android, iOS
Scripting Runtime (Mono, and/or IL2CPP): Mono

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

"Firebase.Storage.StorageException: No content provider:" error was raised when image file path from Android device local storage entered directly into storageReference.PutFileAsync().

I resolved this issue by adding "file://" in front of the image path as suggested in the comments from a different issue I found below:

(ArthurHub/Android-Image-Cropper#466)

Steps to reproduce:

  • Open the MainScene.unity in the quickstart-unity storage sample and replace the UIHandler script with the one attached below

https://github.com/firebase/quickstart-unity/tree/master/storage/testapp/Assets/Firebase/Sample/Storage

UIHandler.cs.zip

  • Update the "MyStorageBucket" path with your cloud storage path
  • Replace the "var localFilenameUriString" in the "protected IEnumerator UploadFromFile()" method with the filepath to an image on your android device.
  • Build the project on Android and click the "Upload from File" button to see the error logged on screen.

(If you are getting "no permission" type errors in the log, check that the app has asked for storage permissions, set write permissions to "External SD Card" in the configuration section in Player Settings and use a run time permission plugin such as the one below to ask for permission to access storage)

https://github.com/yasirkula/UnityAndroidRuntimePermissions

I resolved the error by adding "file://" in front of the image path as mentioned earlier. But it may be helpful for the Storage plugin to natively add any required prefixes to the file path depending on build platform (iOS, Android), or update the documentation on the cloud storage guide so that developers new to cloud storage will know the syntax quirks when uploading files on iOS and Android.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

The issue was found in the quickstarts project

What's the issue repro rate? (eg 100%, 1/5 etc)

100%

@bryanlands bryanlands added the new New issue. label May 19, 2020
@bryanlands bryanlands changed the title Request - Firebase Storage SDK: Natively add mobile prefixes when uploading file via Androi/iOS build Request - Firebase Storage SDK: Natively add mobile prefixes when uploading file via Android/iOS build May 19, 2020
@chkuang-g
Copy link
Contributor
chkuang-g commented May 29, 2020

@bryanlands

Thank you for reporting this.

Since there are two types of urls: content:// and file://, I think it is required for the developer to specify that in the urls.

At the very least, we can do a bit better job at the documentation here

I'll report this to the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants