Method: Agilib::PushNotification::Platform::Android.send_notification

Defined in:
lib/agilib/push_notification/platforms/android.rb

.send_notification(message, data = {}, device = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/agilib/push_notification/platforms/android.rb', line 12

def self.send_notification(message, data = {}, device = nil)
   gcm       = GCM.new(@@api_key)

   registers = [device.register] 
   
   data[:description] = message unless data.has_key?(:description)

   options   = {data: data}
   
   gcm.send_notification(registers, options)
end