Android GCM instanceID.getToken()在Gingerbread上引发TIMEOUT异常 [英] Android GCM instanceID.getToken() throws TIMEOUT exception on Gingerbread

查看:71
本文介绍了Android GCM instanceID.getToken()在Gingerbread上引发TIMEOUT异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所示,当尝试在API 10模拟器上使用Google Cloud Messaging获取令牌时,出现TIMEOUT异常.我已在设备上添加了我的Google帐户,并检查了同步"是否已启用,并且还添加了 接收者清单中的<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>仍然无法找出是什么原因造成的:

As the title indicates I get a TIMEOUT exception when trying to get token using Google Cloud Messaging on API 10 emulator. I have added my google account on the device, checked that "Sync" is ON, also added the <action android:name="com.google.android.c2dm.intent.REGISTRATION"/> in the manifest in the receiver and still cannot find out what is causing this:

11-25 17:35:00.896 29750-29774/com.example.alexis.myapplication W/InstanceID/Rpc: No response android.os.ConditionVariable@b667bc18
11-25 17:35:00.896 29750-29774/com.example.alexis.myapplication E/MYAPP: TIMEOUT

以下是权限的清单声明:

Here is the manifest declaration for permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission android:name="com.example.alexis.myapplication.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.alexis.myapplication.permission.C2D_MESSAGE" />

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

接收者:

<receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        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.example.alexis.myapplication" />

        </intent-filter>
    </receiver>

任何帮助将不胜感激.

注意:我在2.3.7中使用genymotion模拟器,我没有要测试的硬件设备.

Note: I am using genymotion emulator with 2.3.7, I don't have a hardware device to test.

推荐答案

使用了硬件设备,并且一切正常,因此是模拟器的错误.

Used a hardware device and everything worked so it was emulator's fault.

这篇关于Android GCM instanceID.getToken()在Gingerbread上引发TIMEOUT异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆