Refer Coin Firebase Database Multiples The Coins Until App Crashes
I've added refer coin system to my app in which if you refer it to someone you get 100 coins & the person refers code you were using get's the same. Bu the issue is when I run
Solution 1:
The problem in your code lies in the fact that you are using addValueEventListener. This means that you are listening for changes in real-time. Every time something changes in your database, the listener fires. Since you are listening to the same location you are performing the updates, the listener fires over and over again. What you need is addListenerForSingleValueEvent, to get the data exactly once.
To solve this, simply change the call to:
addValueEventListener()
To:
addListenerForSingleValueEvent()
And your code will work perfectly fine.
Post a Comment for "Refer Coin Firebase Database Multiples The Coins Until App Crashes"