def send_match_score_update(cls, match): users = PushHelper.get_users_subscribed_to_match(match, NotificationType.MATCH_SCORE) gcm_keys = PushHelper.get_client_ids_for_users(ClientType.names[ClientType.OS_ANDROID], users) if len(gcm_keys) == 0: return notification = MatchScoreNotification(match) message = notification.build(ClientType.OS_ANDROID, {ClientType.OS_ANDROID: gcm_keys}) gcm_connection = GCMConnection() gcm_connection.notify_device(message)
def send_subscription_update(cls, user_id, sending_device_key): clients = PushHelper.get_client_ids_for_users("android", [user_id]) if sending_device_key in clients: clients.remove(sending_device_key) if len(clients) == 0: return notification = UpdateSubscriptionsNotification(user_id) message = notification.build(ClientType.OS_ANDROID, {ClientType.OS_ANDROID: clients}) gcm_connection = GCMConnection() gcm_connection.notify_device(message)
def send_gcm(cls, notification): gcm_connection = GCMConnection() gcm_connection.notify_device(notification)
def send_gcm(cls, notification): from controllers.gcm.gcm import GCMConnection gcm_connection = GCMConnection() gcm_connection.notify_device(notification)