예제 #1
0
    def post(self, requestId=""):
        request = self.getRequestByUUID(requestId)
        request.requestAccepted = True
        self.response.status = 200

        # Send everyone a push notification about the request being accepted
        gcm = GCM('AIzaSyC6y8uyxPSjxPABKieRa2iB2wLxFVyJuQY')
        data = {'param1': 'value1', 'param2': 'value2', 'appName': 'SafeWalk'}
        users = User.query().fetch()
        gcm_ids = []
        for user in users:
            gcm_ids.append(user.gcmID)
        response = gcm.json_request(registration_ids=gcm_ids, data=data)
예제 #2
0
    def get(self, requestId=""):
        """Respond to a GET request."""
        user = self.getRequestByUUID(requestId)
        user.requestAccepted = True
        user.put()
        logging.info("requestAccepted = %s" %str(user.requestAccepted))

        # Send everyone a push notification about the request being accepted
        gcm = GCM('AIzaSyC6y8uyxPSjxPABKieRa2iB2wLxFVyJuQY')
        data = {'param1': 'value1', 'param2': 'value2', 'appName': 'SafeWalk'}
        users = User.query().fetch()
        gcm_ids = []
        for user in users:
            logging.info("user = %s" %str(user))
            logging.info("this gcm_id = %s" %str(user.gcmID))
            gcm_ids.append(user.gcmID)
        logging.info("gcm_ids = %s" %str(gcm_ids))
        response = gcm.json_request(registration_ids=gcm_ids, data=data)
        
        self.response.status = 200;
        return