Open bitcoinvsalts opened 8 years ago
the other thing downloadUrl does not work with android, it gives me permission error.
so I need to have platform specific code.
here is my current solution that is not ideal:
firebaseApp.storage.uploadFile(`posts/${uid}/${imageName}`, source, {
contentType: 'image/jpeg',
contentEncoding: 'base64',
})
.then((res) => {
console.log('The file has been uploaded')
console.log(res);
console.log("----------");
console.log(`posts/${uid}/${imageName}`);
firebaseApp.storage.ref(`posts/${uid}/${imageName}`).downloadUrl()
.then((res) => {
console.log("--- if iOS this should work ---");
console.log(res.url);
...
})
.catch((error) => {
console.log("--- not working with android ---");
console.log(error);
console.log("so we use the previous res.downloadUrl");
console.log(res.downloadUrl);
...
})
Just to clarify, the issue is that the res.url
exists on ios
and not on Android?
res.url exists on android res.url does not exist on ios
running npm v 2.3.3 confirmed just now
I submitted a PR for this: https://github.com/fullstackreact/react-native-firestack/pull/148
Awesome. Will take a look shortly
I have the same problem on Android.
Method on iOS works fine, but on Android:
error: {code: 1, message: "User does not have permission to access this object."}
On iOS this: const storageRef = firestack.storage.ref(
${path}/${name})
storageRef.firestack.configured == true
But on Android is false.
Maybe is because on Android use GoogleService-Info.plist
and in Android use javascrpit config.
My android config is ok?
const configurationOptions = {
debug: false,
APIKey: Constants.API_Firebase_ApiKey,
storageBucket: Constants.API_Firebase_StorageBucket,
databaseURL: Constants.API_Firebase_DatabaseURL,
};
const initialState = {
firebaseApp: new Firestack(configurationOptions),
};
On debug mode, at configure:
[info] Native error occurred while calling configure: FirebaseApp name [DEFAULT] already exists!
I init Firestack on Reducer initialState, like on iOS, but on iOS emualtor it works.
PD: On iOS exist res.url
PD2: Thanks for this component!
Somebody has solved this issue? I cant get downloadUrl on Android because i havnt permission.. but on iOS works fine.
@auser can u help me?
double check that you have setup the Firebase Android API: https://firebase.google.com/docs/android/setup The google-services.json needs to be added to the /app directory and the android project files need to be updated.
I am getting the same issue "FirebaseApp name [DEFAULT] already exists!", full error from react native:
firestack | [info] Native error occurred while calling configure Object {msg: "FirebaseApp name [DEFAULT] already exists!"}
This occurs just after calling this.firestack = new Firestack({ debug: true });
I do have the google-services.json file in the /app folder, and have Google Play services installed. I am using API 23 and the latest RN & Firstack.
Looking around the internet, it seems this error occurs because a second instance of the firebase app is being created by RN/Firestack. I have this error whether using the google-services.json or providing the constants in the configuration as @luisfuertes did.
Any help would be appreciated. Let me know if I should make this it's own issue, only putting it here because it seems others in this stream have run into this error.
I have the same issue on Android as well...
but it is present with android