firebase-realtime-database

Firebase Event Listener inside Android Worker

懵懂的女人 提交于 2020-04-11 07:06:41
问题 I am trying to implement a Worker from Android WorkManager with an Event listener for Firebase database reference. It works fine if the app is in foreground/background. But once I close the app and the worker runs the event listener is not triggering, As far as I can tell I am not getting any error messages related to this in log. Here is a sample code: class FirebaseWorker(context: Context, params: WorkerParameters) : Worker(context, params) { override fun doWork(): Result { val

Firebase Event Listener inside Android Worker

匆匆过客 提交于 2020-04-11 07:06:14
问题 I am trying to implement a Worker from Android WorkManager with an Event listener for Firebase database reference. It works fine if the app is in foreground/background. But once I close the app and the worker runs the event listener is not triggering, As far as I can tell I am not getting any error messages related to this in log. Here is a sample code: class FirebaseWorker(context: Context, params: WorkerParameters) : Worker(context, params) { override fun doWork(): Result { val

when I manually change value in firebase database I create more items in listview instead of updating value in listview

天大地大妈咪最大 提交于 2020-04-07 08:00:11
问题 I have No idea what's going wrong in my code Please Help Me. Just Trying To Retrieve data to list view. My MainActivity.java public class MainActivity extends AppCompatActivity { ListView listView; FirebaseDatabase database; DatabaseReference ref; ArrayList<String> list; ArrayAdapter <String> adapter; User user; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); user = new User(); listView = findViewById(R

Error: Reference.child failed: First argument was an invalid path

青春壹個敷衍的年華 提交于 2020-04-07 07:34:25
问题 I have this small app with Firebase and i'm implementing CRUD operations. The issue comes when I have to delete a post. I get this error: Error: Reference.child failed: First argument was an invalid path Here is the service code: createReview(review) { return this.db.list('/reviews').push(review) } getReviews(){ return this.db.list('/reviews'); } deleteReview(id:any){ console.log(id) this.db.object('/reviews/' + id).remove(); } Component TS delete(review) { console.log(review) this

com.google.firebase.database.DatabaseException

余生颓废 提交于 2020-04-05 15:37:34
问题 When I start the activity, it is showing the error: Class com.rcpl.agni.Artist does not define a no-argument constructor.If you are using ProGuard, make sure these constructors are not stripped. protected void onStart() { super.onStart(); ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { //artistList.clear(); for(DataSnapshot artistSnapshot : dataSnapshot.getChildren()){ Artist artist = artistSnapshot.getValue(Artist.class);

com.google.firebase.database.DatabaseException

China☆狼群 提交于 2020-04-05 15:37:27
问题 When I start the activity, it is showing the error: Class com.rcpl.agni.Artist does not define a no-argument constructor.If you are using ProGuard, make sure these constructors are not stripped. protected void onStart() { super.onStart(); ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { //artistList.clear(); for(DataSnapshot artistSnapshot : dataSnapshot.getChildren()){ Artist artist = artistSnapshot.getValue(Artist.class);

Firebase POST custom ID

天大地大妈咪最大 提交于 2020-03-27 07:19:07
问题 is there a way to set a custom ID in Firebase when using the POST method? something like: { "users": { "user_one": { "username": "jdoe", "password": "123" } } } I'm working on a Vue.js project and trying to save some students and their parents like: let padre = { nombre: this.padre.nombre, apellido: this.padre.apellido, cedula: this.padre.cedula, nacionalidad: this.padre.nacionalidad, estado_civil: this.padre.estado_civil, instruccion: this.padre.instruccion, profesion: this.padre.profesion,

How to return DataSnapshot value as a result of a method?

纵饮孤独 提交于 2020-03-25 16:36:14
问题 I don't have much experience with Java. I'm not sure if this question is stupid, but I need to get a user name from Firebase realtime database and return this name as a result of this method. So, I figured out how to get this value, but I don't understand how to return it as result of this method. What's the best way to do this? private String getUserName(String uid) { databaseReference.child(String.format("users/%s/name", uid)) .addListenerForSingleValueEvent(new ValueEventListener() {

How to use snapshot result, in a firebase transaction

穿精又带淫゛_ 提交于 2020-03-25 13:45:38
问题 0 I have a Scores node in my database. At the moment, I can update the score after a game. For the purposes of creating a leaderboard, I want to add the users username to the node as well. I have tried to use Transactions that take a snapshot, to get the current logged in username, that when the score is updated, the name will also be added to the Scores node. I can retrieve the username using my transaction, but cant figure out how to pass this value, to the Scores node. This is what I have

How do I lock down Firebase Database to any user from a specific (email) domain?

半城伤御伤魂 提交于 2020-03-24 00:04:51
问题 I have a small, personal Firebase webapp that uses Firebase Database. I want to secure (lock down) this app to any user from a single, specific domain. I want to authenticate with Google. I'm not clear how to configure the rules to say "only users from a single, specific domain (say @foobar.com ) can read and write to this database". (Part of the issue that I see: it's hard to bootstrap a Database with enough info to make this use case work. I need to know the user's email at the time of