I was wondering if there's a way to send a push notification to a device from an android application that I developed or not. Also, if it is possible to develop my php server in a way that it would request a push notification to be sent to a specific device. I have already tested the SDK with my application and it receives the notification if I sent it from mixpanel.com. I just want to make the thing automated for convenience.
I'm trying to implement an application with a messaging feature and need to notify the user that will receive the message when they receive it. I read a lot about GCM and there doesn't seem any good documentation out there and everything doesn't work no matter what and I always get errors. Mixpanel should do the job, but in order for me to be able to send push notifications, I have to be logged in to their website and use the website to send the notification. I also tried to use HTTP request and send a request to the URL that sends the push notification, but I need to be logged in and it just doesn't work.
Any help would be much appreciated as I have to get this application done as soon as possible!
Thanks
You can get Mixpanel to send your push notifications automatically using the "Notifications" feature- you don't have to log in to Mixpanel every time. You can set up the notifications to be sent based on a user's properties. If you want to send a notification based on some event in your app, you can send a people analytics update to Mixpanel when that event occurs.
So suppose you want people to receive a push notification to their mobile device every time they sign up in your web app. On the "Thanks for signing up" page of your app, you'd put something like the following:
// Assuming you've added the Mixpanel JS snippet to your page
mixpanel.identify(SOME USER DISTINCT ID);
mixpanel.people.set("Signed Up", true);
Then, you could set up a notification in Mixpanel with "Signed Up Is True" in your Mixpanel project. The next time you set a user to "Signed Up", they'll get a GCM notification.
Related
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.
I am now trying to make a mobile app push notification service on Firebase. But the function description is not quite specific as I expected.
I want to know these functions are available on Firebase. If not, It would be pleasure If you tell me other tool.
User can select the push message types they want to receive.(Ex. Receive sale information push, Do not receive game event push)
Instantly send auto push messages when user triggered certain condition.(Ex. Send appreciate push message when user closed their first app-open)
Thank you
Can not tell in much description here:
1. User can select the push message types they want to receive.(Ex.
Receive sale information push, Do not receive game event push)
You can use FCM's channeling feature,
You can set different channels.
Show the list of channels to user.
User can subscribe to the required channel.
User will receive the specific channel notification only.
Please refer : Notification Channel
2. Instantly send auto push messages when user triggered certain condition.(Ex. Send appreciate push message when user closed their first app-open)
You have manage this thing in your front end and backend logic.
Like on app close send request to the backend (can use onDestroy method )server and then the backend server will send notification.
Hope this will help you.
For Feature 1:
You can achieve this without even doing anything. Just send all notifications to everyone. However, use different Notification Channels. Users, can then choose to turn on/off certain notification channels using the Android system features (in relatively newer versions of android).
Another way could be to send these notifications to different FCM Topics. Give the users a settings pages, where there can select what kinds of notifications they would like to receive. In response to their selections, subscribe or unsubscribe them to the respective FCM Topic.
For Feature 2:
There could be several hundred ways of doing this. Can provide better advice if you could provide more information about your requirement.
If you talk about your example requirement
(Send appreciate push message when user closed their first app-open)
You can do it without any server, or push messaging scheme. Just keep track of the first_open event inside the app using Shared Preferences. Once you detect a first_open event, just compose a notification inside of the app locally, and show it whenever you like.
I am creating mobile application using latest version of Ionic 3. And I am at the point where I need to implement push notifications. I am using FCM. I have managed to done it for Android phones using this plugin: https://github.com/phonegap/phonegap-plugin-push. Reading documentation for this plugin, it says that for Android I should send only Data Messages and that that is the best practice. It also says that send Notification and Data payload would not work properly:
When your app is in the foreground any on('notification') handlers you have registered will be called. If your app is in the background, the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your on('notification') handler will not be called as messages that have notification payloads will not cause the plugins onMessageReceived method to be called.
But for IOS I need to send notification message with data payload. This would not be a problem if I target directly devices, however I need to send Topic Messages. So the way I see is that on my server I need to implement this logic:
Let's say that the name of topic is FOOD-AND-DRINKS:
function onSomeEvent($data) {
// send push notification to topic ANDROID~FOOD-AND-DRIKS
// send push notification to topic IOS~FOOD-AND-DRINKS
}
Also, since in the future my plan will include multiple cities, and not all people would like to listen for notifications for cities other the one where that person lives, so then my topic would be PLATFORM~CITY~CATEGORY.
So my question would be, is there any better plugin for handling notifications, or some service between my server and Google FCM and that service would take care of that, or this is quite OK what I have proposed?
You can use cloud functions to be able to send notifications since you are using FCM also.
More on this here: https://firebase.google.com/docs/functions/
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
Using cloud functions you can use database triggers like onWrite() and it will be able to send notifications if you have data payload and/or notification.
But if you use data payload alone then you can send if android device is in background also.
Regarding Topics:
If you have multiple cities in your application, then you can let the user register to each topic. You can do in the database like this:
city-category
id_here
cityname: nameX
//other details
id_here1
cityname: nameY
//other details
I have a cross platform application and i want to send notification to sign in users about their messages.
Now I confused about uses of push, local notifications.
What I think of Push notifications is that it is for sending Announcements to users which is not specifically related to their account only.
Can anyone help me out with what should I use? I already used Local notifications in one of my applications with such requirement.
It mainly depends on; is the data coming from local or remote?
You cannot control when your users open the app, and only when they open the app (with a few exceptions) you are able to fetch data. Then with that data you would be able to schedule a local notification. But in most cases that doesn't make much sense, because they have already loaded and probably seen the data. It only makes sense when you schedule an alarm clock for instance.
When you want the data to come from remote, like when they receive a message, you will have to use push notifications. The user is then alerted that new data is available without having to go look for it themselves. It is pushed to them.
However, for push notifications you will need infrastructure which you did not when using local notifications. You will need a server to handle the push notifications (Azure has some awesome functionalities for this) and some trigger to send push notifications. This can be an insert on a database, or a scheduled task. Also, the user has to enable push notifications and your app has to register itself to be able to receive them. It can be a pain to implement it the first time.
It depends on for what reason you're sending the notification.
A local notification is sent locally on the device, so it doesn't need an internet connection. Examples could be:
Send a birthday message when the user has birthday
In a harvesting game, send a local notification when the store is full
A Push Notification is sent from a server and it requires internet on your device to receive it. Examples:
You get a message in a chat while the app is not open (if I understand your question right, this is your case)
In a game: realtime events which are triggered by a server
So in your case, if guess you want to notify the user about new messages if he does not have the app opened. This notification comes from a server and is a Push Notification.
As you describe you want to send notification about sign in users about their messages. so it would be the real time notification about when there is message for user you need to notify the user. so apple having PushNotification is the best approach you need to apply for this. using that you can directly notify user about the new messages.
Why LocalNotification is not useful in this scenario?
I think messaging is the realtime stuff. local notification is not for that. its for only managing local notify stuff. like reminder OR to do added task.. and many more
I am creating a native Android application that sends push notifications to a specific list of friends. How to send push notifications just to this specific list in Android ?
Actually Push Notification mainly sends from server, from application side you must need to create one Browser Key on Google Api Console, after creating your app there and need to activate GCM from there.
Then, you need to give GCM Registration Id to your server and then whatever push you want to fires, server triggered one query with it and will send push to all your friends list.
Take a look the Urbanairship, it provides send the notification by registered tag/id, and also provide broadcast notification.