Google CCS(GCM) - 项目未列入白名单

Gas*_*ton 12 whitelist google-cloud-messaging

我正在尝试使用我发现的Python代码:http: //developer.android.com/google/gcm/ccs.html 我用(我认为)正确的数据更改了前两行.projectnr和api键是假的,它只是向你展示它几乎看起来如何.

import sys, json, xmpp
SERVER = ('gcm.googleapis.com', 5235)
USERNAME = '489713985816'
PASSWORD = 'AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98'
Run Code Online (Sandbox Code Playgroud)

我创建了一个谷歌api项目(尝试了2个不同的项目).激活的GCM.复制以下内容:项目编号:489713985816 API密钥:AIzd237jjN_iT7yRxLWiHRreqax45XaMJQ6VJ98尝试使用服务器密钥和浏览器应用程序密钥(包括和不包含特定IP地址).

当我使用#python ccs.py执行代码时,我得到以下结果:如果这是我的问题,我如何将我的项目列入白名单?

Invalid debugflag given: socket
DEBUG: 
DEBUG: Debug created for /usr/lib/python2.7/dist-packages/xmpp/client.py
DEBUG: flags defined: socket
DEBUG: socket       start Plugging <xmpp.transports.TCPsocket instance at 0x1ea2950> 
into     <xmpp.client.Client instance at 0x1ea27a0>
DEBUG: socket       start Successfully connected to remote 
host ('gcm.googleapis.com', 5235)
DEBUG: socket       sent  <?xml version='1.0'?>
<stream:stream xmlns="jabber:client" to="gcm.googleapis.com" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" >
DEBUG: socket       got   
<stream:stream from="gcm.googleapis.com" id="FD82304ADA8C8019" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
<stream:features>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-OAUTH2</mechanism>
<mechanism>X-GOOGLE-TOKEN</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>
DEBUG: socket       sent  <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
mechanism="PLAIN">MjgzMVqTl9p\nVDdUTZWSjk4\n</auth>
DEBUG: socket       got <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<temporary-auth-failure/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
Project 489713985816 not whitelisted.</text>
</failure>
</stream:stream>
Authentication failed!
Run Code Online (Sandbox Code Playgroud)

小智 3

您可能不想尝试以下指南http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

我遇到了与您相同的问题,但遵循本指南帮助我获得了推送通知,而无需注册加入白名单。