Meteor - How to send notification to user on android? - android

I'm very new in meteor and I just made a simple app that show news (text) for a school, the problem is that no one knows when they write something new because the app doesn't have notification. I can't figure out how to use raix:push or richsilv:cordova-notifications because the test of raix:push didn't work in my device (android) and richsilv:cordova-notifications just work with android and I couldn't make it automatic. Saying "automatic" I mean "when the mongo collection is updated a notification is sent"

I think you may need to set up push server for sending notification to Android client.
Google is providing such option, where client app has to register with GCM server. On successful registration, google will give reg Id, which has to be stored in DB.
From your server make HTTP request to GCM server with Reg Id and message. GCM will deliver the message to appropriate device.
Please refer https://developers.google.com/cloud-messaging/gcm

Related

How to ensure firebase has received push notification sent from app server, without android app

I am new with Firebase. I want to send push notifications to an android app from a spring application. At preset I dont have an android app. I want to test whether the firebase integration is correct or not, which means I want to make sure that the push notifications sent from the backend server are recieved correctly in firebase .
How do I ensure that firebase has recieved the push notifications sent from backend server?
Is it possible to test push notifications without an android app registered on firebase? If yes, how do I do that?
I am using Firebase Admin SDK. Do I need a separate server key other than the service account key for sending notifications?
You'll get a success (or fail) response when sending messages. This means that FCM has received your message and it will try to deliver it to the users.
FCM needs to target your app in order to send notification. If you don't set up FCM SDK in your app, it wont be able to do so.
You just need to generate an auth token. This guide should help you set it up.

FCM Push notifications 1000 users limit at a time issue

I am using FCM to send push notifications to all my android app users to tell them about new poetry and wallpapers/backgrounds added to server
Its working is like this:
When user install android app first time its device token is received on our server via rest API written in php on server side and we are sending push notifications to user as soon as new wallpaper is available done via their device tokens received on our server by getting these from database in array and passing that array to FCM CURL Call in php
Our Issue:
Limit reached can not be exceeded from 1000 tokens at a time
Our tries to solve that:
We are sending now with for loop of each 900 users at a time in php and calling CURL to FCM in php for each 900 users again and again.
Now notification are being received on some device and some are missing.
Tell me how can I reliably send notifications to all devices without any limit issue instantly?
There is a very easy solution to that. If you want to send notification to a group of users, you just have to subscribe them to a topic. For that you can use one line of code in your app FirebaseMessaging.getInstance().subscribeToTopic("<topicName>");. A few hours after the first user subscribed to the topic, you will also be able to see it in the Firebase console. You can also subscribe users to topics using the Firebase Admin SDK.
Android
Admin SDK

Sending Notification to user when user is offline in android using XMPP

I implemented an Android chat application using Smack client with XMPP server. Everything works fine when the user is online, now when the user is offline (the app is not in running state). I would like to push notification using GCM.
Is there a way to achieve that, and is there a way that we can manage our server itself to take care of that?
I'm facing this problem too.I'm solving this as folowing steps:
Develope a WebService (ASP or PHP or ...) with a database that will contains users FCM-TOKENS per JID
Developing FCM on android devices and send TOKEN whent it refreshed to my WebService and save it in db.
Activate "CallBackOnOffline" plugin in openfire. (that sends POST request with a JSON to defined url when a message received but recipient is UnAvailable)
Set "plugin.callback_on_offline.url" in "Service Properties" to my WebService. So the message and the jid will be sent to my web service.
Now fetch the FCM-TOKEN from my web service db and send a request to FCM containing message body and title.
You can send push notification any time the user is online or not but the device has internet.You have all devices device tokens so when you send a message to a particular user, use his device token and send push notification.

Sending push notification without server: web app to android

I'm totally new to hybrid world so I have to ask first.
Can I send notifications through GCM without a server?
I mean, I'm building a SPA with AngularJS and Firebase, but my customer asked me to make a dashboard for Android, so every time an user makes an order, they (both dashboard administrators) receive a PUSH notification on their phone: "A new order has been created", and when they "tap", the application opens.
I've been reading something about /topic/ endpoint to notify both of them, but I think I still need a server to do it. Do I?
It would be great if I simply post a http query using something like AngularJS' $http service to tell GCM to send a notification for that topic/usergroup.
Is that possible? If so, any idea about how?
Thank you very much in advance!
Sending a downstream GCM message can be done "without a server". One option is to send an HTTP request to GCM containing the required fields. Topic Messaging is available with GCM which does make it easier to send downstream messages without a server. Your client apps can subscribe for messages from /topic/usergroup and then you can send an HTTP request with /topic/usergroup as your "to" value, and subscribed clients will get it.
Note that you will need to set up a Google Developer Console project to get the required API key.
Check here for more information on the structure of GCM HTTP downstream messages.

GCM between User to User from same Android App

I would like to implement GCM in my Android app:
One Android app
Registered- U_user and another M_user.
I have Google Sign In in my app thats works fine with JSON and GSON and local MySQL database server with tomcat-server restutil to keep storing Gmail login users.
So, I want to send a notification from U_user to M_user.
U_user does a registration that has been pushed to M_user.
How can I do this?
I am assuming you mean the same Android app installed on different phones (U_user's phone and a separate phone for M_user).
To quote a section in the docs:
To make sure that messages go to the intended user:
Your app server can maintain a mapping between the current user and the registration ID.
The app can then check to ensure that messages it receives match the logged in user.
What this means is that you can send messages to another user through GCM. To let the app server know what to send to M_user, let U_user send an upstream message to your GCM app server (only possible in app servers using XMPP - see here). Alternatively, you have the option to do POST requests to your app server via HttpUrlConnection (can work on both XMPP- and HTTP-based GCM app servers).
Regardless of which method you use, specify in these messages to the server that you would like to send a message to M_user.

Categories

Resources