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.
Related
How is that Google, in Firebase Console Notification composer, allows to set notification target to a specific app package name, yet I read there is no way to do it with API? How to send Firebase message to specific application in project?
Is there some hidden capability Google not exposing to devs?
I know about topics, but it takes extra work to set and subscribe to, plus they won't work right away and require some wait time.
The Notification Composer is an online tool hosted by Firebase.
Therefore it already knows the Server Key (required to send messages) associated to each of your projects.
By design (and for obvious security reasons), the Server Key is implicitely linked to a single app, and you can't use it to send a message to different apps.
The Firebase Console allows us to send notifications to single users, groups, users subscribed to topics or to the entire user base. Is there any code that allows us to directly send notifications in the same way, but programmatically?
For example, if I had a list of users (containing their Firebase UIDs), if I click on one of the users, could I send a notification to that user through Firebase the same way the console allows us to send a notification through the console?
This Firebase Blog uses the Google App Engine Flexible Environment to actually send the notifications, but it requires a free trial and costs money.
This Quickstart doesn't really show how to send user to user notifications. It focuses on the subscription-based notifications, but this isn't really what I need.
Is there any good way of doing this with Java/Kotlin and the Firebase API?
FCM doesn't support you sending message directly from Android app to Android app. However, this is a workaround to solve your problem:
Create a firebase cloud function. Listen a special path in firebase database
Android app 1 push a data (maybe Android app 2 ID) to this path
Firebase cloud function process data, determine who to send notification (Android app 2).
Firebase cloud function push notification to Android app 2.
ref: https://firebase.google.com/docs/functions/use-cases#notify_users_when_something_interesting_happens
In a basic concept: we write our server to get action from firebase database and decision to send notification to other user by FCM. This our server can write with NodeJS or using Firebase Cloud Function (above)
Guide how to using Nodejs is here: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html
We are changing from an App vendor to a home-built App and we have tens of thousands of users opted in to push notifications in our Android App and this is the main way that users get into our App each day.
We have the tokens for the users from the current push vendor so we can migrate those into our push vendor, however the existing App is using our old App vendor's GCM (google cloud messaging) account from their Google Account.
I believe that if we setup our new App and push vendor configuration with our own GCM (or preferably FCM, firebase cloud messaging) account, then even with the push tokens we won't be able to reach the users in the new app until they open it and re-opt back in. We'd like to avoid this since the existing users mostly come in via a push, so they will go dark once we update the App in the Play Store and can no longer push to them.
Is there a way to avoid this? Perhaps a way to migrate them from the current GCM account to a new FCM account and preserving the ability to push to them without them having to open the App? The App bundle Id and name and all that are staying the same and continue in our same Google Play Developer Console, it's only the GCM account that we want to change to our GCM/FCM account.
Thanks for any assistance you can provide.
Can anyone help me with a way to send requests as a notification through my android app to all the users who have installed my application and then their responses are sent back to the user who sent the request.
I have read about GCM but I dont understand how can I register all the users to get their GCM registration ID and how can i simulataneously send a notification to all users..I may sound naive but I am completely new to this GCM concept and I dont think that it is the exact thing what I am looking for..
So,somebody please tell me how to send notifications(simultaneously on click of a button or something..) to all the users who have registered in my android app .
You will need to build a server component that keeps track of all registered users. This component will be an app that you write and expose in the cloud. There are many app-hosting services to choose from. Amazon EC2 is one example.
So the app flow would be something like this:
User launches your Android app.
Android app registers itself with GMC. GCM will respond with a token that represents that device.
Android app POSTs that device token to your cloud application.
Cloud application saves that token. The app should now have a list of tokens that represents all active devices running your app. (of course you may want to have an expiration policy - i.e. remove all tokens corresponding to devices you have not heard from in say 30 days).
One of your app users posts a message that s/he wants to broadcast.
Your Android app responds by sending a request to your cloud application.
Your cloud application responds to this request, by making a request to GCM. In this request (or series of requests), the app will include all device tokens and the user-entered message.
GCM responds by pushing the message to all devices with your app (i.e. all of those that have register with GCM and received a token - see step 2).
If using GCM alone you would need to write a server component. I get the impression you don't want to do this. You could use Urban Airship push messaging, which will allow you to send out a message to all registered apps from the Urban Airship web portal. Urban Airship integrates with GCM (which is easy to setup). You would still need to add code to your app to handle the push notification the app receives.
http://docs.urbanairship.com/build/android.html
We have a system that generates android apps automatically. The users enter in our website and login in their accounts and the users make a description of wich functionalities want and our system automatically generates the signed android apk and publishes on market.
The apps are published on the market with our developer account, not with the user account.
Such users would need PUSH notifications, for example, through GCM, to their applications. Therefore, we need to know if there is any way to automate the process so that users only have to enter on our website their google accounts and the message they want to send their applications, and our system must automatically send the messages to the phones that uses the user applications.
You have to remember and highlight the following factors:
Applications are published in the market under our developer account.
Users who have created their apps through our system have their own google accounts (not developer accounts) and want to send their messages from their accounts of Google and to its applications only, not those of others users and not using our google developer account.
The whole process should be automatic and transparent to the user, since they should only provide these data, their google account, the message they want to send, and the app that must receive the message.
Would it be possible to do this by GCM?
There is a GCM API with which to communicate to perform all these steps automatically?
Thanks
I think you could, but the user must register in GoogleApis to have their own SENDER_ID, then you should make a webservice in which you associate each user to their SENDER_ID and provide them an interface that only send notificatios using their SENDER_ID, however you should have a strong enough server to achieve this since Big Data could be an issue because you must also store the device_ids associated with each of your clients application, also you would be getting registration and unregistration intents from each application installed.
I have used Both Server Side (Grails) & Client Side (Titanium) to send notifications to the android device. So, I will be explaining you both one by one. But before that you need to add ADT plugin in to your Grails framework.check out http://tinyurl.com/chfthpe