Canonical IDs

Greg Blake edited this page Mar 29, 2018 · 5 revisions

Android docs: Canonical IDs.

GCM under certain situations will require you to update your registration IDs. You must listen for these events and update your records accordingly. Rpush provides a reflection hook for you to implement:

Rpush.reflect do |on|
  # Called when the GCM returns a canonical registration ID.
  # You will need to replace old_id with canonical_id in your records.
  on.gcm_canonical_id do |old_id, canonical_id|
   # Example code if you have a Class 'Device' with an attribute 'registration_id':
   d = Device.find_by(registration_id: old_id)
   d.update_attributes(registration_id: canonical_id)
  end
end

See Reflection API for more information.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.