Android rpush中缺少GCM的通知属性
在Android rpush中缺少GCM的通知属性,android,ruby-on-rails,google-cloud-messaging,Android,Ruby On Rails,Google Cloud Messaging,在rpushgemforandroid通知的文档中,它说: n = Rpush::Gcm::Notification.new n.app = Rpush::Gcm::App.find_by_name("android_app") n.registration_ids = ["..."] n.data = { message: "hi mom!" } n.priority = 'high' # Optional, can be either 'normal' or 'high' n.
rpush
gemforandroid通知的文档中,它说:
n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name("android_app")
n.registration_ids = ["..."]
n.data = { message: "hi mom!" }
n.priority = 'high' # Optional, can be either 'normal' or 'high'
n.content_available = true # Optional
# Optional notification payload. See the reference below for more keys you can use!
n.notification = { body: 'great match!',
title: 'Portugal vs. Denmark',
icon: 'myicon'
}
n.save!
运行时,出现了一个错误:
NoMethodError:未定义的方法“notification=”
我检查了模型,发现它没有包含notification
属性
=> #<Rpush::Client::ActiveRecord::Gcm::Notification:0x007fb90f610790
id: nil,
badge: nil,
device_token: nil,
sound: "default",
alert: nil,
data: nil,
expiry: 86400,
delivered: false,
delivered_at: nil,
failed: false,
failed_at: nil,
error_code: nil,
error_description: nil,
deliver_after: nil,
created_at: nil,
updated_at: nil,
alert_is_json: false,
type: "Rpush::Client::ActiveRecord::Gcm::Notification",
collapse_key: nil,
delay_while_idle: false,
registration_ids: nil,
app_id: nil,
retries: 0,
uri: nil,
fail_after: nil,
processing: false,
priority: nil,
url_args: nil,
category: nil,
content_available: false>
=>#
有什么问题吗?将
rpush
版本更新为2.7.0
,2天前刚刚升级到此版本