Handle errors in GCM responses

Delete devices from the database if the appropriate errors are returned.
If "error" is different than "Unavailable", delete the device.
    
This is according to:
http://developer.android.com/google/gcm/http.html

Oh damn, my bad. Let me correct this.


On Wed, Aug 27, 2014 at 8:50 PM, Adam Bogdał <notifications@github.com>
wrote:

> In gcm/models.py:
>
> > @@ -28,6 +28,36 @@ def get_queryset(self):
> >      get_query_set = get_queryset  # Django < 1.6 compatiblity
> >
> >
> > +class GCMMessage(api.GCMMessage):
> > +    GCM_INVALID_ID_ERRORS = ['InvalidRegistration',
> > +                             'NotRegistered',
> > +                             'MismatchSenderId']
> > +
> > +    def send(self, regs_id, data, collapse_key=None):
> > +        ret = super(GCMMessage, self).send(regs_id, data, collapse_key)
> > +        self._update_db_from_response(ret)
> > +        return ret
> > +
> > +    def _update_db_from_response(regs_id, response):
>
> post_send name seems more understandable.
> Why we have here two params regs_id and response?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/bogdal/django-gcm/pull/17/files#r16799926>.
>