'Push the message relating to google cloud messaging server
@param title: The title for notification
@param message: The message to be sent to GCM server
@param api_key: The API key for GCM server
@param registration_ids: The list of id that will be notified
@param channel_id: The specific channel_id to use for GCM push'

def gcm_push(self, title=None, uri=None, message=None, registration_ids=None, channel_id=None):

    if ((not title) or (not uri) or (not message) or (not len(registration_ids))):
        return
    from gcm import GCM
    gcmtable = current.s3db.msg_gcm_channel
    if channel_id:
        query = (gcmtable.channel_id == channel_id)
    else:
        query = ((gcmtable.enabled == True) & (gcmtable.deleted != True))
    row = current.db(query).select(gcmtable.api_key, limitby=(0, 1)).first()
    try:
        gcm = GCM(row.api_key)
    except Exception as e:
        current.log.error('No    API    Key    configured    for    GCM:    ', e)
    else:
        try:
            notification = {'title': title, 'message': message, 'uri': uri}
            response = gcm.json_request(registration_ids=registration_ids, data=notification)
        except Exception as e:
            current.log.error('Google    Cloud    Messaging    Error', e)
        else:
            if ('errors' in response):
                for (error, reg_ids) in response['errors'].items():
                    for reg_id in reg_ids:
                        current.log.error(('Google    Cloud    Messaging    Error:    %s    for    Registration    ID    %s' % (error, reg_id)))
    return
