Google Cloud Messaging客户端未收到来自服务器的消息(GCM)

时间:2012-07-11 11:28:21

标签: android cloud messaging

  

可能重复:
  android GCM doesn't work

使用GCM演示项目我设法注册了一些设备(在网站上,在Tomcat服务器中运行我可以看到它们列出)但是当我点击发送消息按钮时,客户端没有任何反应,没有消息收到了。

Tomcat日志显示了这一点:

0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET / HTTP/1.1" 200 11444
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /tomcat.css HTTP/1.1" 200 5926
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /tomcat.png HTTP/1.1" 200 5103
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /bg-upper.png HTTP/1.1" 200 3103
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /bg-nav.png HTTP/1.1" 200 1401
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /asf-logo.png HTTP/1.1" 200 17811
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /bg-middle.png HTTP/1.1" 200 1918
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /bg-button.png HTTP/1.1" 200 713
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:10:57 +0200] "GET /favicon.ico HTTP/1.1" 200 21630
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:11:06 +0200] "GET /gcm HTTP/1.1" 404 974
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:11:30 +0200] "GET /gcm-demo HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:11:30 +0200] "GET /gcm-demo/ HTTP/1.1" 200 134
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:11:30 +0200] "GET /gcm-demo/favicon.png HTTP/1.1" 200 949
172.20.5.53 - - [11/Jul/2012:11:14:27 +0200] "POST /gcm-demo/register HTTP/1.1" 200 -
172.20.5.53 - - [11/Jul/2012:11:14:27 +0200] "POST /gcm-demo/register HTTP/1.1" 200 -
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:14:43 +0200] "GET /gcm-demo/ HTTP/1.1" 200 235
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:14:52 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:15:09 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:15:33 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:15:41 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:23:35 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:23:56 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 319
172.20.5.53 - - [11/Jul/2012:11:28:21 +0200] "POST /gcm-demo/register HTTP/1.1" 200 -
172.20.5.53 - - [11/Jul/2012:11:28:21 +0200] "POST /gcm-demo/register HTTP/1.1" 200 -
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:28:51 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 403
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:29:02 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 403
0:0:0:0:0:0:0:1 - - [11/Jul/2012:11:56:09 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 403
0:0:0:0:0:0:0:1 - - [11/Jul/2012:12:12:21 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 403
0:0:0:0:0:0:0:1 - - [11/Jul/2012:12:37:13 +0200] "POST /gcm-demo/sendAll HTTP/1.1" 200 403

有任何线索吗?这是我的表现:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.gcm.demo.app"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

    <uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <permission
        android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission
        android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE" />

    <uses-permission
        android:name="com.google.android.c2dm.permission.RECEIVE" />

    <!-- Main activity. -->
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="com.google.android.gcm.demo.app.DemoActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="com.google.android.gcm.demo.app" />
            </intent-filter>
        </receiver>

        <service android:name=".GCMIntentService" />
    </application>

</manifest>

我正在测试一个11 sdk版本的设备。

提前致谢。

0 个答案:

没有答案