Run query to get Event count from big query - android

I am asking how to run query to get event count from my android application.My app using Firebase realtime database and we linked firebase analytics to Big query.How to get my custom event count by run query from my android application.or Tell me how to get that count from my android app,i have one field in my application to show that count.

Only the data gathered by Analytics will be exported to Big Query once the linkage has been established.
Raw data for event count should be available in the event_dim as per the Big Query Export Schema.
Refer to the sample queries for Firebase-Big Query for more details in this official Google docs.

Related

I creat a query that hold some info from firebase

I creat a query that hold some info from firebase And I got this error
this is the error
And this is my query query
thi is the body
When i run my code the first if statement appears in the screen, which is the error I had
I tried to delete the where condition for the status but i had the same error
Okay, this is very simple, from your images I couldn't see anything but I think I know what is going on.
how firebase work is that when you use where() to query a collection it works fine but if you use 2 or more where() the firebase will take longer so to improve that they allow indexing and the error you got it should have a long URL in it click it and it will take you to your firebase project and create the needed indexes for you.
wait for like 5 min for them to build and retry using that query from your app
PS: some time the indexing is required even with just 1 where()

Get data entry count using firebase analytics

I am new to Firebase Analytics and I went through some online tutorials to learn about it. I have a simple 'Notes' app (Android) in market, which allow users to create and save notes offline on their device.
It would be great, if I could get a total number of notes that have been created till date with my app. I know, I can add an event which will notify Firebase when user creates a new note, but what about the existing notes that are present in the database?
Is there any way to get such statistics through Firebase Analytics?
UPDATE:
I have included a user property as notes_count, but I am not able to find a way to see the total. How to do it?
You could set a user property with the number of notes the user has created instead of or in addition to logging the event. You are limited to 25 different user properties total though, so use them with care.

Android Google Firestore Notify user app that there is new data in Firestore

I am building an android app that uses both Room and Firestore.
The app will have a long list of items that are stored in Firestore. When the user first launches the app the app will read all the items from the Firestore and store them in Room and from then on the users app will read the item list from Room.
Now, this item list will change but only about once a month so I need a system where I can update the list in Firestore and then send a message to all users that the items list has changed. They must then do a one time fetch to get the updated items list from Firestore and write it to Room.
Using Firestore listener is not an option as this will result in hundreds of unnecessary reads every time a user opens the item list activity.
Also Firebase Cloud Messaging only seems to be recieved by users whos apps are online.
Is there a way to notify all users apps (even those that are offline) that the data set has changed and that they must execute a fetch and retrieve the updated item list?
Is there a way to force users to check for new messages from Firebase Cloud Messaging whenever the app starts so they can get the updated item list?
Instead of using FCM to serve this information, I would integrate a "list" version number into a document that is accessed whenever you start up the app.
For example, it's common to have a service status document (such as /global/status) that contains important meta information such as latest application versions for your mobile apps (to show "Please update" messages), information about upcoming outages or links/IDs to blog posts that you use to serve news/messages to your users.
If you have a suitable document, you would add an entry for "listVersion" that could be a timestamp, a version number or the like. If using a version number, you have the added benefit of being able to use semantic versioning and give it special meaning. Update immediately for major changes, prompt the user to update their database (if on mobile data) for minor changes and maybe update only over WiFi in the background if it's only a patch (such as fixing a typo somewhere). To mix the version number with a timestamp, just use the year and month as the major and minor versions and keep the patch number as is (e.g. v2019.11.28). The meaning of each version is up to you as how you are updating the list and it's purpose is not known.

Firestore document sharing without scanning entire collection

I am learning my basics for Firestore and trying to build an app which allows user1 to share a document with user2/3/4 etc.
For billing purposes, every query which results in a document read counts towards the cost. So, I do not want to follow the approach of adding the user2/3/4 etc emails to a 'sharedWith' variable to type: array or map type structure as I believe every user will then have to scan the entire collection and pick the documents where their email appears.
Is there any other approach to this where user1 can programmatically give access to user2/3/4 of one specific document?
For billing purposes, every query which results in a document read counts towards the cost.
That's correct and according to the official documentation regarding Cloud Firestore billing:
There is a minimum charge of one document read for each query that you perform, even if the query returns no results.
So you're also charged with one document read, even if your query does not return any results.
I believe every user will then have to scan the entire collection and pick the documents where there email appears.
That's also correct. So let's assume the email address that you are looking for exist in a document that is appart of 10k collection of documents. So if you query the database only for that particular document, you'll be charged with only one document read and not for those 10k. So you are charged according to the number of items you get back and not to the number of items your request them from. And this is available for the first request, when you get the data from the Firebase servers. If in the meanwhile nothing has changed, second time you get the data from the cache since Firestore has the offline persistence enabled by default. Which means you aren't charged for any other document reads.
Is there any other approach to this where user1 can programatically give access to user2/3/4 of one specific document?
Without writing the data to database, there is not. So you should add the ids or email addresses to the desired documents and perfom a query according to it.

How to schedule task which will execute every 1st day of month and update a value in Firebase realtime database

I am using firebase realtime database in my android app.I have details of every person along with a field feepaidforcurrentmonth boolean.I have 2 fragments feespaid and feenotpaid. When fee is paid for current month feepaidforcurrentmonth becomes true and gets updated in firebase database and the member is added to the list of feespaid fragment from feenotpaid.
My question is how do I schedule task in firebase/or in my app to set the value of field feepaidforcurrentmonth false every first day of month?How do I update it in firebase database?
This sounds like a task you should do in the backend rather than the frontend (your app).
You could use an external self written and hosted backend, e.g. python that's triggered by a cron tab.
Here's a blog post from firebase about the topic. They are using Google App Engine to trigger based on time / date.

Categories

Resources