azure notification hub, android devices category - azure-notificationhub

for an app, I have multiple categories of notification on android devices on as in screenshot.
Settings on categories are different, some show's lights, others play custom sounds, etc
what should be the appropriate payload to deliver the notification to the app with category. I have tried
{
"notification":{
"title":"Contact Pulse",
"body":"This is a sample notification delivered by Azure Notification Hubs.",
"category": "Local Notifications" // tried with this
},
"category": "Local Notifications" // tried with this as well
}
Expected end result is when category is "Local Notification", play the custom sound and other category its silent.
Notifications are delivered on every case, but it not behaving as per the channel configs.
note: above scenario works well with data: {} (handled at the app level), but doesn't work with notification: {}.

At time of writing, Azure Notification Hubs only supports the FCM Legacy HTTP server protocol. For this reason, you'll need to provide the notification category information as the "android_channel_id" as documented here.

Related

How Google's Gmail app on iPhone disable notifications?

My question can seems weird, but I just realize that when I receive a push for a new mail from Gmail app and I open Gmail on a web page, the notification disappear.
Can someone explain me how this is working ?
This is related to this question, though it's not an exact duplicate.
This can be implemented with Apple Push Notifications.
Your server has to maintain for each user a list of device tokens of all the devices belonging to that user (iPhones, iPads, etc...).
When the user reads the message on one platform (whether via a web browser or via a mobile application), you can execute some API call on your server to notify it that the user read the message.
Then your server can send a follow-up push notification to all the devices belonging to that user with "badge"=0 (and without the "alert" and "sound" fields), and the notification will be cleared from the lock screen and app icon.
One possibility is that they use notifications delivered in the background (they get delivered directly to the app rather than being shown to the user), then use local notifications. Local notifications can be cancelled.
So it would go like this:
remote notification "there's a new e-mail" delivered in the background
local notification "new email"
...
you connect to the website
remote notification "user has seen new e-mail" delivered in the background
cancel local notification
I've never actually tried to do this, but I suppose that would be the way it works. I'm not aware of any (documented) way to cancel a remote notification directly.

Newsstand Notification Server

I am currently working on my first Newsstand app. The basic gist of it is there are two XML feeds. If no subscription is detected, it loads the free.xml which just has a couple of free issues on it. If a subscription receipt is detected and valid, it shows the listing of all current issues. The XML just has title, link, description, and pubDate tags in it. The link is where it is located and the app downloads it and then displays it. My issue is how to send out newsstand notifications. I know it is slightly different than regular Push, in that it has ability to trigger automatic downloads of new issues. I currently use xtify.com for standard push notifications, but I could use some guidance on how to set up notifications for the newsstand app.
To trigger automatic downloads in the Newsstand app, you have to send an extra key-value pair as follows along with other keys. The new key content-available with value 1 is responsible for invoking the application even in the background.
{
"aps":{
"content-available":1,
}
}
If your current push notifications service provider allow you to add this key, its well and good, otherwise you have to use your own server and setup push notifications and add this key to the payload.
In addition to this, make sure:
You enable Newsstand in iTunes Connect
In your Device Settings > Newsstand > Automatic Content Download must be "ON" for your app
Push notifications are "ON" for your app.
For more information on Newsstand applications, following tutorial is very helpful, please go through it. Understanding it answers many of your doubts.
http://www.viggiosoft.com/blog/blog/2011/10/17/ios-newsstand-tutorial/

can i implement an app that have 2 types of notification (Remote and newsstand notification)

i need to know if i can implement an app that can handle 2 types of notifications
Thanks
Both remote and local notifications enable an application to inform its users that it has something (information) for them - in a form of a notification (It could be a message, an impending calendar event, or new data on a remote server), when the application isn't running in the foreground.
When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.
The difference between the two are:
Local notifications are scheduled by an application and delivered by iOS on the same device. Local notifications are available in iOS only.
Push notifications, also known as remote notifications, are sent by an application’s remote server (its provider) to Apple Push Notification service, which pushes the notification to devices on which the application is installed.
Push notifications are available in both iOS and, beginning with Mac OS X v10.7 (Lion), Mac OS X.
Going back to your question, the answer is YES.
As per discussed in the Apple documentation:
To have iOS deliver a local notification at a later time, an application creates a UILocalNotification object, assigns it a delivery date and time, specifies presentation details, and schedules it. To receive push notifications, an application must register to receive the notifications and then pass to its provider a device token it gets from the operating system.
When the operating system delivers a local notification (iOS only) or push notification (iOS or Mac OS X) and the target application is not running in the foreground, it presents the notification (alert, icon badge number, sound). If there is a notification alert and the user taps or clicks the action button (or moves the action slider), the application launches and calls a method to pass in the local-notification object or remote-notification payload. If the application is running in the foreground when the notification is delivered, the application delegate receives a local or push notification.
For further understanding, read more about Local and Push Notifications.

Apple push notification service, when device is off line

My push notification service in sandbox development phase works well when the device is online. It keeps getting push messages.
However if a message is sent from te provider (server) when the device is offline (no 3g or wifi), the device is not receiving the push message when it gets online.
Any thoughts on this?
UPDATE New rephrased documentation is here
Thanks AL
After going through Apple's Quality of Service https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
It retains only one notification per application on a device:
Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.

push notification - background process - iPhone

I have just heard that - " push notification " is possible in iPhone
I need following details.
what is push notification ?
How it works ?
What does it requires ?
Any sample code link is available ?
Any documentation link if available ?
Some guidance/tips from "StackOverFlow Masters" about developing the above requirements.
Thanks in advance for sharing your knowledge with Stackoverflow family & me.
The sort of background processing you're looking to do is not possible with push notification.
Push notification allows you to notify the user of something. An example would be a Twitter client that sends a notification when the user receives a direct message on Twitter.
Push notification can not react to things happening on the iPhone when the app is not running. Instead, it depends on you having a server that determines when to send a notification and then sends one.
I'm not seeing any need for background processing in your application. If you store the user's initial location, the next time the app loads you can get their location and calculate the distance between the two. If you're looking for the route travelled, you're out of luck unless you make a deal with AT&T like Loopt just did.
Push notification is not really for that purpose, you should read up on push notification in apples site here http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html, its more for when theres data like a m essage for your user, you can have the user get it without having them open t he application. Now for your purpose, why cant you store the location when htey close the app, once the reopen the app you can reget a location, use the previous location and the new location to calculate the km travelled?
Although only tangentially related to this discussion, I think you might be interested in Loopt's agreement with AT&T to track user's iPhones (for a monthly fee).
Apple Push Notification service (APNs for short) is the centerpiece of the push notifications feature. It is a robust and highly efficient service for propagating information to devices such as iPhone, iPad, and iPod touch devices. Each device establishes an accredited and encrypted IP connection with the service and receives notifications over this persistent connection. If a notification for an application arrives when that application is not running, the device alerts the user that the application has data waiting for it.
Software developers (“providers”) originate the notifications in their server software. The provider connects with APNs through a persistent and secure channel while monitoring incoming data intended for their client applications. When new data for an application arrives, the provider prepares and sends a notification through the channel to APNs, which pushes the notification to the target device.
Check this link clearly explained Apple push notification services
http://mobiforge.com/developing/story/programming-apple-push-notification-services