Comments (51)
I'm refactoring things as we speak so I'll definitely check it out. Thanks for your efforts.
from nativescript-plugin-firebase.
You said "Reproduced trying the demo for this repo against the same firebase I've been using. Same behavior, the console says a key was created but no new data appears." so I guess you cloned this repo and followed the instructions in the readme. Since that's using Firebase 2.x you don't need to add google-services.json etc because that's a Firebase 3.x requirement.
from nativescript-plugin-firebase.
That's hardly ignorant :)
Let me update the demo app first so you can simply clone that.
from nativescript-plugin-firebase.
Thanks for all your help!
from nativescript-plugin-firebase.
I just deployed my proof of concept from a few weeks ago to my phone again, and that has no trouble writing to firebase.
I believe the only difference in my setup between then and now was that I had to add multiDex to the build.grade in the most recent project.
from nativescript-plugin-firebase.
Can add a bit of loggin to the push
function of the firebase plugin and see if it's invoking the correct methods at all? I have no idea what's up though, can't reproduce this issue on my sample app.
from nativescript-plugin-firebase.
@EddyVerbruggen I added some basic logging to push
in firebase.android.js
, and the method is getting called with the correct parameters, and the promise is definitely resolving, but still no data in firebase. How else can I help debug this?
from nativescript-plugin-firebase.
I'll give it a shot with the sample app linked from the readme and see if that gives me any trouble.
from nativescript-plugin-firebase.
Reproduced trying the demo for this repo against the same firebase I've been using. Same behavior, the console says a key was created but no new data appears.
from nativescript-plugin-firebase.
Awesome, thanks @EddyVerbruggen
Collected a little more dataβI tried the demo against another Firebase instance as a sanity check, same behavior. The only way I'm deviating from the setup in the readme is setting the applicationId
in platforms/android/build.gradle
instead of the recommended app/App_Resources/Android/app.gradle
. I'm doing this because I don't see app/App_Resources/Android/app.gradle
in either the advanced seed that I'm using to prototype, or the demo from this repo.
I tried creating a new app/App_Resources/Android/app.gradle
and setting just:
android {
defaultConfig {
applicationId "com.entercastle.ng2Test"
}
}
but still no luck.
from nativescript-plugin-firebase.
Just tried the demo app again - the 'store by push' button results in:
Are your rules the same as mine (evenybody can read/write), or do you authenticate the user before writing?
Let me see if moving the applicationId
to that file makes a difference for me...
from nativescript-plugin-firebase.
@EddyVerbruggen indeed, free-for-all on the permissions:
Note: I updated those strings to booleans, still no luck
from nativescript-plugin-firebase.
It's a bit weird that you don't have app/App_Resources/Android/app.gradle
as that comes standard when starting a new NativeScript app with the CLI. I'm running 2.x, you too?
from nativescript-plugin-firebase.
Are you 100% sure your Android device can reach your DB? WiFi connection OK?
from nativescript-plugin-firebase.
As for "Are you 100% sure your Android device can reach your DB? WiFi connection OK?", the init succeeds, and my device has no trouble accessing the internet through other channels.
from nativescript-plugin-firebase.
OK, asked because if you disable WiFi you can still store data if persist: true
is passed in init - and it will sync with the server once you have a conncetion.
from nativescript-plugin-firebase.
Hmm, I'll flip that bit and see if that affects anything. I do have it set to persist currently
from nativescript-plugin-firebase.
I guess if your Android browser can reach the FB URL you should be fine.
from nativescript-plugin-firebase.
No luck with setting persist to false.
from nativescript-plugin-firebase.
Puzzled.. the weird this is, the demo app you just tried is using an older version of the plugin (with the Firebase 2.x SDK). Can you just keep it connected to the demo Firebase db and see if that makes a difference? Just clone it without modifications..
from nativescript-plugin-firebase.
More data, just tried my prototype of the advanced-seed in a genymotion emulator, same behavior.
from nativescript-plugin-firebase.
I'm confused what you mean by just clone it without modifications? Don't I need to add the google-services.json and do the rest of the setup for it to work?
from nativescript-plugin-firebase.
Can I clone you repo and run it on my Android device?
from nativescript-plugin-firebase.
Well most of the config is in files that aren't tracked by version control (stuff in platforms/android), so I can't easily pass my project. However, I wrote up pretty detailed instructions on my setup here.
from nativescript-plugin-firebase.
I cloned the demo repo and ran without any config/setup. The push appears to be working from the console, but I don't have access to the firebase admin, so I can't tell if it's actually writing.
from nativescript-plugin-firebase.
Can you run 'store by push' in the demo again and report back the key that's echo'd in the console?
from nativescript-plugin-firebase.
Just did a few:
JS: firebase.push done, created key: -KKUsE-bfHox3yL4Iyqe
JS: firebase.push done, created key: -KKUsFPUVzVGVlTfhVfr
JS: firebase.push done, created key: -KKUsFwVYrXgIjxnwFer
JS: firebase.push done, created key: -KKUsu5BumnQ6CfeqICS
JS: firebase.push done, created key: -KKUsuDm6ILN9NIxR95O
from nativescript-plugin-firebase.
This is so weird. So the old and new version don't work for you.
Firewall issues? Does it matter if your try 3g/4g vs WiFi? π
from nativescript-plugin-firebase.
Disconnected from wifi and sent a few more:
JS: firebase.push done, created key: -KKUto1cK-VZzejdn0eW
JS: firebase.push done, created key: -KKUtoRME_k8ZTEgOIZM
JS: firebase.push done, created key: -KKUtoZMDYCoouEjBEH-
I really don't think it's a generic network thing because it works fine from web & an iOS emulator.
from nativescript-plugin-firebase.
Oh shoot, that's not the correct firebase instance sorry. You're connecting to https://resplendent-fire-4211.firebaseio.com
but it should be https://n-plugin-test.firebaseio.com
. Please change that here and run again.
That old instance turned up in some kind of limbo state after migrating my account to Firebase 3.
from nativescript-plugin-firebase.
Updated the ref:
JS: firebase.push done, created key: -KKUvHpBbWGIlNBR35Ya
JS: firebase.push done, created key: -KKUvIDchsV3uY1W87eP
JS: firebase.push done, created key: -KKUvIJbq2UxCysFBNuq
from nativescript-plugin-firebase.
Cool, so the Firebase 2.x plugin/demo push correctly:
Can you now connect your app to this Firebase instance? So https://n-plugin-test.firebaseio.com
?
from nativescript-plugin-firebase.
I'm happy to try, but the setup is different for 2.x and 3.x and my app is using the latest version of this plugin. Is there a specific version you want me to hop back to and try?
from nativescript-plugin-firebase.
I'd say just use the latest with what you already have (your app, not the demo) and connect your app to my Firebase instance. The instances are backward compatible and I can clean it up afterwards with one click.
from nativescript-plugin-firebase.
"connect your app to my Firebase instance" => Please excuse my ignorance here, but I only know how to do that with the google-services.json file
Is it as simple as adding the url to the init call?
from nativescript-plugin-firebase.
More data: I have one instance on my machine of the angular2-advanced-seed from a few weeks ago where this plugin was working fine, iOS & Android. I was looking at the difference in npm dependencies across the projects and noticed this plugin differed by a minor update (3.0.0 in my project that's working, 3.1.0 in my latest). Unfortunately, I got the same behavior when explicitly using 3.0.0 in my latest: the push promise still resolves, but no data is stored. :[
from nativescript-plugin-firebase.
Can you make sure your Google Play services stuff is up to date by running android
in a terminal and updating those bits?
from nativescript-plugin-firebase.
I installed the versions in the SO post linked from the readme. Currently on Google Play Services (rev 30) and Google Repository (rev 26). Currently updating Google Repository to rev 28
from nativescript-plugin-firebase.
In other news: I've just pushed 3.1.0 to npm and update the demo app so please clone it, follow the steps in the README of that repo (!) and don't change google-services.json so you connect to my Firebase instance.
(off to bed)
from nativescript-plugin-firebase.
Installed and configured with your google-services.json
, then tried a few pushes:
JS: firebase.push done, created key: -KKVL21TlTVNZvRI43zO
JS: firebase.push done, created key: -KKVL2Zp7Lt_ZEY61r5P
JS: firebase.push done, created key: -KKVL2llq6c3nrg49xHe
from nativescript-plugin-firebase.
Yes! Those 3 at the bottom arrived at y Firebase instance:
So what happens if you now add your google-services.json
to the demo app? Make sure the applicationId is the same as the one in this file, etc.
from nativescript-plugin-firebase.
Amazing, that's working for me. I'll keep you posted on whether or not 3.1.0
resolves the issue in my prototype. Thanks again for all your help so far. π
from nativescript-plugin-firebase.
Sorry just to chime in here. Could the issue not have something to do with the fact that new projects created in the new firebase console are not backward compatible with the javascript firebase 2.x.x SDK?
IE Old projects there were migrated would work with 2.x.x and 3.x.x firebase SDK but new projects are only able to use 3.x.x.
from nativescript-plugin-firebase.
I ran into a similar experience with web @matdehaast. I couldn't authenticate from the 2.X SDK to a new firebase instance created from the google console, but their customer support verified the claim in the migration guide that the 2.X SDK should still work if you migrate from firebase.com. I'm yet to verify their claim.
from nativescript-plugin-firebase.
@EddyVerbruggen so the demo is working when I swap your google-services.json for mine, but when I start a fresh angular2-advanced-seed and follow these instructions, I'm still getting the same behavior from before: the call to push resolves, but no data is stored in firebase:
// libs
import {Store} from '@ngrx/store';
// app
import {FormComponent} from '../../frameworks/core.framework/index';
import {NameListService} from '../../frameworks/app.framework/index';
var firebase = require('nativescript-plugin-firebase');
@FormComponent({
moduleId: module.id,
selector: 'sd-home',
templateUrl: 'home.component.html',
styleUrls: ['home.component.css']
})
export class HomeComponent {
public newName: string = '';
constructor(private store: Store<any>, public nameListService: NameListService) {
firebase.init({
persist: true // Allow disk persistence. Default false.
}).then((instance:any) => {
console.log('firebase.init successful'); //succeeds
firebase.push('/counters', 100).then((result:any) => {
console.log('pushed', result.key); //logs a key
}, (err:any) => console.log(err));
}, (error:any) => {
console.log('firebase.init error: ' + error);
});
}
/*
* @param newname any text as input.
* @returns return false to prevent default form submit behavior to refresh the page.
*/
addName(): boolean {
this.nameListService.add(this.newName);
this.newName = '';
return false;
}
}
from nativescript-plugin-firebase.
@lowe0292 Is it incorrect for me to say that if the plugin works in the demo app and not in some other app the problem is not with the plugin but with the other app?
from nativescript-plugin-firebase.
That sounds like solid logic to me.
from nativescript-plugin-firebase.
@lowe0292 did you ever find a solution here? Reading through the comments, very curious indeed.
from nativescript-plugin-firebase.
@NathanWalker nope, never solved it with your seed. In fact, this was the Achilles heel that killed our NativeScript project. π’
from nativescript-plugin-firebase.
@lowe0292 sry to hear, completely understand though. Lot of interesting details above.
If you have a branch or the project laying around, I'd love to fire it up and try to debug it myself!
Lemme know π And we could put this mystery to rest.
from nativescript-plugin-firebase.
I also had the same problem. The Solution was Just to change the firebase realtime database settings ( read and write) to true. Being public, android could now read and write to the database.
from nativescript-plugin-firebase.
Related Issues (20)
- M1 Issue - FirebaseSDK HOT 4
- Several "session_start" event are created on iOS 15 HOT 1
- ERROR TypeError: firebase.init is not a function.
- AdMob error: TypeError: Cannot set property 'resolve' of undefined
- Class constructor ContentView cannot be invoked without 'new'
- Android App Not working with NS 8.2. HOT 42
- A problem occurred configuring root project 'firebase'.
- microsoft login
- Android 12 background notification led to crash (PendingIntent) HOT 6
- Unable to run new deployment HOT 1
- ion
- Error trying to install @nativescript/firebase
- barcode scanning issue - iPhone 13 Pro and iPhone 13 Pro max
- Cannot read property 'ads' of undefined on NativeScript 8.2.3 HOT 1
- Plugin with id 'com.google.gms.google-services' not found. HOT 13
- SetValue of type Date Error on iOS
- Barcode Scanning issue on native script 8 with native camera control
- Mark this repository as deprecated HOT 1
- Firebase Authentication functions are giving error "No reference found.
- Firebase Messaging crash issue in Android 13 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-plugin-firebase.