How to display each push notification separately on android device using GCM - php

I am sending push notification to my phonegap app from server. Its getting delivered successfully, but the problem is if I send multiple notifications old one get overrides.
For example
at 10:00 AM -
Notification 1 Received
at 10:01 AM
Notification 2 Received
in this Notification 1 Received get overwrite by second message. But I want to show both messages as they important.
I googled it and found solution on stackoverflow for same.
GCM message is getting overridden?
but its for android, and I am using phonegap and php to send notification,
is there any way to assign that we can retain both messages on user screen.
Thanks in advance.

Your issue is with the payload data you are sending with PHP.
From the documentation at https://developers.google.com/cloud-messaging/http-server-ref#notification-payload-support
tag: Indicates whether each notification message results in a new entry on the notification center on Android. If not set, each request creates a new notification. If set, and a notification with the same tag is already being shown, the new notification replaces the existing one in notification center.
One option is to treat tag as a uniqid, as long as you do not really need to go back and update some unread notifications. If you do need to update a notification, choose an id that works in your case.

Related

How to send a push notification to a user that is in my database using FCM? android

For example, I need to send a notification to a particular user. When the user sends me a trouble-message, I will push a notification which notifies him that the trouble will be fix soon.
Now, I have already created a push notification but even when the user is logged out it can still receive a notification. And when I'm using a different account it can still receive the same notification for the other user.
please help me create a push notification that will send to a specific-signed-in-user. Thank you. (Sorry I'm new here in android.) thank you very much again.
You cannot send to a specific user, you can only send to specific devices. Your server/app needs to handle the logic of users and keys associated with them

Do I have any way or another service to push notification that have different message (payload) to different tokens in One http request?

My purpose: One Push Notification to iOS app, badgeNumber on device need to update based on each device's badge increment.
We knew that we can send only one message (payload) to different tokens
in iOS, We cannot update badge number even we receive remote notification when App is forced to close from background.
I want to use above method to send Different Badge Number to each device, since I get badge number for device from my DB Server.
I used FCM for iOS push notification
for Server-side, I use PHP
Some discussion(Android GCM - Send different payload to each user in registration_ids array )
said it's not possible, so is there any way or paid service?
Some said we need to send each payload to each device tokens using loop. Example, I have 1000 tokens, will APNS block my future request?
For my app's usage: around 50 push/day
Thank for your contribute.
Some notes to your comment:
You can update badge if the application is dead, but it cannot be a silent notification, if silent it will simply ignored. Using a "normal" notification with badge in payload you can, in fact update it even killed manually.
You must keep in database all the device token with user associated, and send individual notification, you can't send bulk message with different content (in this case with different badge).
No, it will not block, you can send for each one:
This is from another forum but can be used as reference:
According to the "Push Notification Troughput and Error Checking" section of this Tech Note:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG44
"There are no caps or batch size limits for using APNs."
"If you're seeing throughput lower than 9,000 notifications per second, your server might benefit from improved error handling logic."

Apple Pushnotification Issue

I am new for apple push notification. I am currently working on ios app with chat funcationality. For this app, web-services are built in PHP.
There is a functionality, when user send a chat message to another user that time we send a push notification through PHP that web-service to message receiver user.
Notification working fine that I have checked.
Now issue is, sometimes push notification works fine but sometime its not.
So I want to know when ios push notification fails to send.
I have put write to log and log shows notification sent successfully.
Thanks in advance :)
You can use the Feedback service to get information about failed push notifications via APN:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3
Looks like the link doesn't anchor to the section - so you will need to search for the entry
:( sry.
Hope that helps

Send gcm messages to different application activty

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?

iphone dev showing date and time in Push notification

I have implemented ray wenderlich's tutorials on Apple push notification, now i want to display the date and time on push notification alert, the time that notification has been sent, i know that there is no child property of alert which can hold date and time, so plz. guide me that is there any way to do it (we are sending notification from server side through a php written cms), i want to display date and time at the top right of the notification alert against the sender name, plz. guide thanx and Regards Saad.
The time when you receive notification may be used to be shown at the right side.
But it is not reliable way, as user can skip any notification. iPhone framework adds icon badge based on value sent in notification.
What you can do is, you can check that value and if it is greater than 0, you can connect to your server by yourself and download the pending notification against that specific user.

Categories