Code Monkey home page Code Monkey logo

Comments (4)

olucurious avatar olucurious commented on August 15, 2024

So, the thing is you need to map registration ids in your database with the respective users and just replace reg_ids when they change

from pyfcm.

siyanew avatar siyanew commented on August 15, 2024

there is another issue here I don't replace users registration id with the old one because users can sign in via different devices so 1 user can have n reg_ids from different devices.

from pyfcm.

baali avatar baali commented on August 15, 2024

Hey, I was looking at the InstanceID documentation and first example API that is info can be used to identify obsolete registration ids. I can think of a function like this for BaseAPI class

def clean_registration_ids(self, registration_ids):
    '''Return list of active IDS from the list of registration_ids

    '''
    headers = {'Authorization':'Key:'+WEB_API_KEY,
               'Content-Type': 'application/json; charset=UTF-8'}
    valid_registration_ids = []
    for registration_id in registration_ids:
        details = requests.get('https://iid.googleapis.com/iid/info/'+registraction_id, headers=headers, params={'details':'true'})
        if details.status_code == 200:
            valid_reg_ids.append(registration_id)
    return valid_registration_ids

Let me know what you think about this, I would be more than happy to submit a PR for the same.

from pyfcm.

olucurious avatar olucurious commented on August 15, 2024

@baali Thanks a lot for the contribution, I'll merge it and update pypi very soon

from pyfcm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.