Firebase Analytics for Android - android

Recently i integrated the firebase notification and migrated from GCM. Everything working well. But i want to know regarding USER-SEGMENT option in firebase console. Its totally works based on firebase analytics and captured some default user-properties and events.
Default capturing user-property :
https://support.google.com/firebase/answer/6317486
But before that the action i want to clarify below few items. Anybody knows reply those questions.
Different between Topic and Audience?. Where we need to integrate TOPIC and Audience?.
How will make the Audience via Firebase? and how will control like today particular user as a free member and captured that person into Free member in particular audience group and then he / she become a paid member, then how will remove that person from that particular audience group?.
Whether any possibilities monthly or day wise audiences can able to send the pushnotification via USER-SEGMENT in firebase console?.
User-property - Where i have to use this option in App?
How will do the firebase analytics for make this report like one particular member will take the action from this particular category?. ( For example : So many members like 20000 members take the action like send a message from Search Page. )
Any ideas regarding these clarification.

An audience is a group of the users of your app that share certain properties. For example, you could define an audience of all users of the Android version of your app from Holland. Then you could send a notification to that audience from the Firebase Console.
A topic is nothing more than a "thing" that the user's app can subscribe to. If you then send messages to that topic through either the Firebase Console of the Cloud Messaging API, it will be received by the apps that have subscribed to the topic.
You could say that topics are groups of users that the app code (and thus potentially the users) determine that they're a part of, while audiences are determined on the server based on app analytics.
You define audiences in the Analytics panel of the Firebase Console.

Related

Should i use multiple firebase projects for different customers but the same app or only one for FCM?

I want to add push notification to my app with Firebase Cloud Messaging but i don't know the right way to set this up.
My app looks like this:
I have multiple customers (companies) who host their own server with a database for their employees.
Every employee of my customers will download the app to receive push notifications from their company's server which implements the firebase admin sdk to send push notifications.
I thought the easiest way would be to let every customer set up their own fcm project and then add the api key to the app.
This is easy to set up in android, but in ios every company would need an apple dev account for the certificates which costs them 99€ every year just too receive push notifications.
So maybe only i need to set up one firebase project myself and generate a server key for every customer. This way only i need a apple dev account.
Is it possible to let every customer send push notifications through my fcm project to their employees but not to any other employees of different customers. They should not be allowed to see any data of other customers or send messages to them.
What's the intended way to set this up and is there a limit to push notifications in one firebase account? If only i host a fcm project for every customer i might hit the limit.
Thanks in advance for your help.
They should not be allowed to see any data of other customers or send messages to them.
If you require isolation between customers, then they should definitely not be using the same project. They should be in different projects, so they can't send messages outside of their own user base.

Removing a user from Firebase

I am using Google's Firebase to manage some of the back end aspects of my mobile application.
Mainly I am using it for authentication with email as well as sending push notifications.
Currently, I have around 10 users who have been registered for a push notification token.
My question is that, I want to send a notification to only 8 users. Is this possible, because I can't seem to find a location where I can select the users.
I tried disabling the users from the Authentication tab but that seems not to make it work as authenticated users and Push-registered users seem to be different.
You can target FCM messages:
To the iOS or Android app that is being used (through the Console only).
To an Analytics audience that the user of the app is part of (through the Console only).
To a topic the app instance is subscribed to (through the Console and the API).
To a group of devices, if you know their group ID (through the Console and the API).
To a specific device instance (i.e. a specific app on a specific phone) if you know their instance ID token (through the Console and the API).
There is no way in the Firebase console to select the users to send a message to. In fact: Firebase Cloud Messaging has no concept of a user, all it knows is the token that identifies the app that it's part of on the device that it's installed on.

Count subscribers of a topic in Firebase Cloud Messaging

What I want to do with my app is this: users can select different interests and as soon as there are more than ~5 people interested in the same thing, I want to send them a notification.
I thought Firebase + Topics would be a good choice for this.
But how do I find out how many people have subscribed to a topic?
There is no available API to check how many subscribers a topic has. (see my answer here)
You'll have to implement the mapping on your server-side, saving the name of the topics and adding in the list of subscribers. Upon subscription, add the new subscriber, check the count (see if it's within your preferred number), then trigger a notification.
U can use this to get number of subscribers :
Go to the Firebase Console "https://console.firebase.google.com/"
Under Grow, click Cloud Messaging.
Open up your developer tools.
Click New Notification and type some title and message
On Target Tab , click on Topic
In the network tab in developer tool you will see a request to an url similar to this one
https://gcmcontextualcampaign-pa.clients6.google.com/v1/4/projects/${projectId}/topics?prefix=%2Ftopics%2F&key=${key}
Copy as a curl. Use that to get subscribers list
Reference: https://gist.github.com/timrijckaert/218be90541a7285e21455fafa2962dea
There is no direct way of doing this. Your only two options are:
Using stored deviceIDs in your own DB, manually script to retrieve each users subscriptions.
Already track in your own DB each users deviceIDs AND every topic they subscribe to.
There are so many problems with both of these methods though. It's frustrating topic managmenet doesn't already exist in FCM Console. I wrote Google a feature request for FCM Cloud Notification Topic Management and this is the response I got:
We're aware that many developers, such as yourself, would like to have
this topic management. There's actually an existing feature request
regarding this. However, I can't provide any details or timelines as
to when this will be available.

Messaging App using MQTT

I am trying to create a android messaging app using MQTT.
But i just want to know how the existing messaging apps(based on MQTT) work?
I am think of creating a unique topic for each user who installs and setups the app for the first time (providing his mobile no/email id for his topic to receive messages from others).
Once the setup is completed the contacts from users device will be synced with my server to check the available users.
And finally the user can select from the available contacts to send messages(publish messages based on the selected contacts mobile no or email id).
I know we should encrypt the contacts to protect the users privacy but,
Am i going in the right direction?
Thanks in advance.
Typically you set up a topic like
appName/device/[deviceID]
you could then put additional topics under that, like
appName/device/[deviceId]/contacts/contactName
You would then create authorization rules that limit a device to only publish things to appName/device/[deviceId]/# for the specific device id.
You could do a topic like appName/device/[deviceI]/contacts/online to get a list of available contacts... and a reply topic that gave back the results.

Having Some issues with google cloud messaging api for android

I am new to gcm api for android and have for some time now i have being working on an android app to allow chatting between two users of the app. The app is such that a chat can only be initiated when one user opts to contact the other user. But my confusion comes in the manner i would be able to create a chatroom for these two users and for the other user to be able receive messages. since i found out that each user must subscribe to a topic inorder to receive messages in that topic. Would i have to subscribe all users to all possible topics or what? that is my big question but it seems it would have so much overhead considering i have 1000+ users.
Please i need all the help i can get here. Thanks
Would i have to subscribe all users to all possible topics or what?
GCM topic messaging allows your app server to send a message to multiple devices that have opted in to a particular topic.
It is not a requirement but it can ease the work for the server to send messages. In this tutorial, you will see that they have created a chat like environment using GCM without using the topic function.
BUT consider the effects on your server like how will it behave on the potential load when you use the topic messaging, especially the the message will trigger an interaction from the user to the server.

Categories

Resources