Esempio n. 1
0
def send_notification(account_id, message):
    with app.app_context():
        api_key = app.config['GCM_API_KEY']
        tokens = AccessToken.query.filter_by(account_id=account_id).distinct(
            AccessToken.push_token).all()

    notification = {'title': 'GitHub Activity', 'body': message}

    for token in tokens:
        if token.push_token:
            send_message(api_key, token.push_token, notification=notification)
Esempio n. 2
0
def send_notification():
    api_key = current_app.config['GCM_API_KEY']
    tokens = AccessToken.query.filter_by(account_id=g.account_id).distinct(
        AccessToken.push_token).all()

    notification = {'title': 'hello', 'body': 'wooooooo works'}

    for token in tokens:
        if token.push_token:
            send_message(api_key, token.push_token, notification=notification)

    return jsonify({'hello': g.name})
Esempio n. 3
0
def send_notification(account_id, message):
    with app.app_context():
        api_key = app.config['GCM_API_KEY']
        tokens = AccessToken.query.filter_by(account_id=account_id).distinct(AccessToken.push_token).all()

    notification = {
        'title': 'GitHub Activity',
        'body': message
    }

    for token in tokens:
        if token.push_token:
            send_message(api_key, token.push_token, notification=notification)
Esempio n. 4
0
def send_notification():
    api_key = current_app.config['GCM_API_KEY']
    tokens = AccessToken.query.filter_by(account_id=g.account_id).distinct(AccessToken.push_token).all()

    notification = {
        'title': 'hello',
        'body': 'wooooooo works'
    }

    for token in tokens:
        if token.push_token:
            send_message(api_key, token.push_token, notification=notification)

    return jsonify({'hello': g.name})