Module: Agilib::PushNotification::Platform::Android

Extended by:
ActiveSupport::Concern
Defined in:
lib/agilib/push_notification/platforms/android.rb

Constant Summary collapse

@@api_key =
nil

Class Method Summary collapse

Class Method Details

.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