Firebase Realtime Database Limit Exceed - android

I want to know what will happen when the limit is exceeded for Firebase Realtime Database. The thing is I know the maximum number of connections I can have is 100 only. Now, suppose my android app has active 1,000 users and I implement Realtime Database. Then the first 100 users will get connect to the database. I want to know what will happen to the user number 101, how I know the connection is unsuccessful, is there any Exception that is thrown or some function isSuccessful(). How to handle that kind of thing in my app.
I have already seen: Link Link
I want to know how to tell the app that it is not connected and when any user disconnects, do I need to run init statement again and when?
Thanks in Advance :)

As found here from a Firebase developer
There is no current way to detect this programmatically. An error
message will be asynchronously thrown in the developer console when
the 51st connection is made.
But this post is from 2014 so maybe that changed.

Related

Firebase Performance Monitoring showing 0 sessions

I have added firebase performance monitoring following the documentation. There is data showing up but its saying 0 sessions and when viewing the sessions no cpu/memory data is showing up but it is saying that I need to update the SDK to see that information.
One of the possible issues is that there is a random sampling on different sessions that can captures such detailed metrics. May be that is causing this happen. Try generating more scenarios and you should be able to see some sessions with actual data.
https://firebase.google.com/docs/perf-mon/automatic?authuser=0#more-detail-trace-samples
Please Check Your Firebase Remote Config

firebase how many current logged in user in my app

So i have app with Firebase email Auth
I want to keep track of how many users are actively logged in right now
A number in firebase database that can keep changing or list of active users right now!
They are removed moment user logs out
We cant exactly do addition in firebase database so how to do that.. any help?
PS: I dont want to use Analytics, i want a database solution
You need to use firebase StreamView : RealTime Analytics
Below are the details
https://support.google.com/firebase/answer/7229836?hl=en
http://firebase.googleblog.com/2017/03/realtime-analytics-for-everyone.html
For real hardcore database solution you can do the following:
You can add a last_login field in your database users collection. Update that field whenever a user resumes your app. Then you will be able to query once or Live Stream about how many users are logged in the last several minutes.
If you are looking for something much more accurate you can update the user last_login every several seconds from your application and Live Stream the last results.
Note that this may cost you a lot of money since firestore is a pay per action database, Which means that you pay for each update and each read from your database.
You can also checkout #Frank van Puffelen comment bellow your answer.
Enjoy!

Is it possible in GCM/FCM to get last activity or if the user is connected?

Am using GCM in my android project, the connection is XMPP, I wonder if there is a way to know if the user is currently connected from within the server service?
One way to do it is that I can send the user a ping and wait for a reply to see if he is connected but I was hoping for a better solution like to query GCM directly and it will tell you if the user is currently online or his last activity date.
I am trying to avoid using socket.io or signalr, because it will add load to the server specially if you have like half million users who are pinging the server regulary.
Thanks
The API you are looking for is not very well advertised, but it exist!
HEADERS: Authorization:key=SERVER-KEY
GET: https://iid.googleapis.com/iid/info/GCM-TOKEN?details=true
Full documentation here: https://developers.google.com/instance-id/reference/server

What is the Optimal approuch to check devices availability from Server

I'm working on a chat Application like Telegram. The user should see his/her friend availability (Online/Offline). I searched a lot and found out that the server must send ping to the devices and devices reply back. But I think it prevents the app to use the server and device resources optimally. You suppose there are a million of users, lots of pings in every interval, lots of device battery and bandwidth use and so on.
I also studied Firebase and GCM. They check device availability to send messages to them, but I can't use it to show it to the users.
I'm really interested in technology that Telegram used for users availability.
Please let me find an optimal way.
Thanks
If you look at the blog post #Andre linked to, you'll see that the "official" Firebase approach to this problem is to store a value in Firebase's Realtime Database that indicates the status of the user. So, the logic is this:
use a property in the database to keep track of a user's status (e.g. /users/{uid}/status)
when a user logs in you set their status to "online"
when the user logs off/puts the app to the background/is idle you change the value of that 'status' property (e.g. to "offline" (use .onDisconnect() method as shown in the blog post).
Now, whenever you fetch the value of that status it'll always reflect the user's online/offline status without relying on the user actually being online at the time.
If you want to show a user the status of all their friends you simply loop through a list of their friends' uid's and get the relevant status for each. All the info/code seems to be in that blog post.

implementing trial status

I want to implement a "10 day trial status" on my application. I found this post that was made back in 2009 (I like the 3rd methos). Has anything changed in this area since 2009? Is there a better way?
Post link...
Creating an Android trial application that expires after a fixed time period
thanks, Gary
The best way to do this would be to set up a MySQL database on your server and store the time and date of the installation and the device ID in it. So every time the user opens your app you check with your server how long the device is already running the app. You could do this or if you don't want to get involved in server side programming you could just create a local SQLite database and do the same(then of corse you won't have to save the device ID). However this is not so safe because the user can access your database if his/her device is rooted. Therefore if you're choosing this way I'd recommend using SQLCipher for Android. It encrypts your database.

Categories

Resources