def post(self, request): android_reg_id = request.POST.get('android_reg_id') if android_reg_id is None: return json_error_response('android_reg_id is required') result = send_gcm(android_reg_id, { 'test-data': 'Umid Qovun JPRQ', }) if result: return json_success_response({ 'message': 'Push is sent to %s' % android_reg_id, }) else: return json_error_response('Push is not sent to %s' % android_reg_id)
def send_push(self, data): return send_gcm(self.android_reg_id, data)