I want to send notification to my iOS application from server side. I am using PHP at server side and FCM to send notifications. I have the server_key for my firebase project.
I sent the following to FCM
{
"to": "red_id",
"data": {
"message": "This is a Firebase Cloud Messaging Topic Message!",
}
}
But I want to send notification globally without using "to" clause. Need help
Firebase Cloud Messaging always send messages to specific targets. While those targets can be broad, there is no way to send untargeted messages.
If you want to send a message to all users of your app, the easiest way is to have your app subscribe to a topic (e.g. all on startup. That way you can target all users of your app, by sending a message to topic /topic/all.
Related
I use telegram bot api to send messages to a channel. I need to disable push notifications for Android and IOS, but when I pass disable_notification = true, I don't get notifications for my desktop client, but my Android and IOS devices get push notifications (without sound).
Is it possible to disable push notifications for Android and IOS for telegram bot api and method send message?
P.S: I use PHP for sending messages to telegram.
No, the user should mute the bot.
disable_notification is only for channels.
From Bot API:
Sends the message silently. Users will receive a notification
with no sound.
The link refers to the channels
Now it's possible to pass disable_notification to sendMessage method -- https://core.telegram.org/bots/api#sendmessage
bot.sendMessage('chat_id', 'text', {disable_notification: true}
I have already experienced to send push notifications to android and apple device with specific device token or registered id and I did use it in different projects, but this time I am just looking for a solution where I can send a push notification to APP means whoever installed the APP will get a notification.
Please let me know if this is possible and if yes then how.
Thanks
You need push tokens to send notification and there is no option to send push message to all devices without knowing their token . But you can send topic notifications if user has subscribed to that specific topic . You may need topic subscription to send push message to all subscribed users .
Client side you can subscribe to topic like
FirebaseMessaging.getInstance().subscribeToTopic("TestTopic");
find it here
I want to send messages to multiple users/Endpoints ARN selecting from MYSQL database without using Topic using PHP SDK.
Amazon Mobile Push can send notifications in two ways:
Push a message to a single end-point
Send a message to an Amazon Simple Notification Service (SNS) topic, and that topic pushes to multiple subscribed endpoints.
To send messages to multiple users/endpoints from a MySQL database, you would need an application that reads from the database, determines what message to send to whom, and then send that individual message to one endpoint. To send to multiple users, use an SNS topic.
See: Amazon SNS Mobile Push Notifications
Unfortunately - SNS allows publishing to multiple endpoints using topic. So you'll have to use that. Keep in mind though for the topic subscription will only work one call at a time for each end-point. It does not have bulk subscription to topic feature yet:
https://forums.aws.amazon.com/thread.jspa?messageID=639931򜎻
Amazon Mobile Push can send notifications in two ways :
Push notifications for a single device with Application single end- point ARN
Send a message to SNS topic and that topic pushed to all subscribed endpoint devices
So, better to use SNS Topic if you need to broadcast same message to multiple users device or, there is a other way to do it by using end-point ARN also. Simple you need to maintain all users information in your database and just trigger message by fetching all members from database and push message one by one to all members.
EG :
$users = all users information having user info and ARN
registered with SNS applications ARN;
foreach ($users as $user) {
//Call AWS SNS pushed code with user's end-point informations, It will
//automatically send all subscribed users in present in your database
//tables also with proper informations
}
I am wondering if it is possible to send push notifications to different Android applications. I can already send a push notification in same application but I want to send notification to different applications of mine. I have user application and driver application. I need to send push notification when user create order and driver get notification that "A new order is come" after driver accept. Acknowledgement notification get back to user.
I am using two different Google API for both Application, I think, its not good way...
Please give idea about this. ? thx
What you want is possible and not that strange at all, you have two applications registered for push in the developer console with two projects ids and want each of your Android application to be able to receive notifications from both ?
If thats what you want its possible you just need to register to both sender ids in the android applications check.
https://developer.android.com/google/gcm/adv.html#multi-senders
basically:
...
if (gcm == null) {
gcm = GoogleCloudMessaging.getInstance(context);
}
regid = gcm.register(SENDER_ID_ONE, SENDER_ID_TWO);
....
push notification with 2 different apps are possible,i make it one database for both apps for save token id, generate 2 push notification. its working fine
Im new to android application development and im developing an app that uses GCM messaging. This app registers to my php webserver. I follow some tutorials about gcm but im really confused. This application has 3 activities:
NewsActivity.java - displays new information and special topics.
MemoActivity.java- displays memo.
3 EventsActivity.java - displays important information about special events.
My problem:
How can the server send gcm messages to specific android activity. For example i want to send gcm message to NewsActivity.java ONLY which means that the message will only be displayed in that specific activity?
How can the app determine if that message can only be displayed on specific activity?
I don't know where to start. Any information you can provide me would be greatly appreciated. Thanks.
GCM Server sends the message to the app. It is received in the Broadcast receiver. There you can find which of your activity is visible by setting a flag to some value in every activity or by other means. Or follow this dealing with received gcm push notification in different activities?