Reputation: 1303
By using Houston, I've got push notification information, as attached picture. However, the device will not show notification message, the info only appear console. I allow my device to accept push notification. What is the problem?
resource "push" do
params do
requires :device_token, type: String
end
post do
APN = Houston::Client.development
APN.certificate = File.read(Rails.root.join('certificates', 'apns', '150927Development.pem'))
# An example of the token sent back when a device registers for notifications
token = params[:device_token]
# Create a notification that alerts a message to the user, plays a sound, and sets the badge on the app
notification = Houston::Notification.new(device: token)
notification.alert = "Hello, World!"
# Notifications can also change the badge count, have a custom sound, indicate available Newsstand content, or pass along arbitrary data.
notification.badge = 57
notification.sound = "sosumi.aiff"
notification.content_available = true
notification.custom_data = {foo: "bar"}
Rails.logger.debug
APN.push(notification)
end
end
Upvotes: 1
Views: 774
Reputation: 2598
Make sure, your app is in background, or closed, otherwise Push Notification Messages won't be visible on Screen. When app is running in foreground, iOS directly passes push Notification message to host app, without showing it on Home screen or Notification Screen.
Upvotes: 1