在不工作的2.3.3和工作的4.x的设备Pushnotifications [英] Pushnotifications in not working on 2.3.3 and working on 4.x devices

查看:124
本文介绍了在不工作的2.3.3和工作的4.x的设备Pushnotifications的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个推送通知样品与本文档 HTTP的帮助://开发商。 android.com/google/gcm/client.html 。它的工作对4.x的设备和不工作的2.3.3的设备。

这是我的权限:

 <使用-权限的Andr​​oid:名称=android.permission.WAKE_LOCK/>
<使用-权限的Andr​​oid:名称=android.permission.GET_ACCOUNTS/>
<使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>

<许可
    机器人:名称=com.example.testing.permission.C2D_MESSAGE
    安卓的ProtectionLevel =签名/>

<使用-权限的Andr​​oid:名称=com.example.testing.permission.C2D_MESSAGE/>
<使用-权限的Andr​​oid:名称=com.google.android.c2dm.permission.RECEIVE/>
<使用-权限的Andr​​oid:名称=com.google.android.c2dm.permission.REGISTRATION/>


   <接收器
        机器人:名称=com.example.testing.GcmBroadcastReceiver
        机器人:权限=com.google.android.c2dm.permission.SEND>
        <意向滤光器>

            <  - !接收的实际消息。 - >
            <作用机器人:名称=com.google.android.c2dm.intent.RECEIVE/>
            <作用机器人:名称=com.google.android.c2dm.intent.REGISTRATION/>

            <类机器人:名称=com.example.testing/>
        &所述; /意图滤光器>
    < /接收器>

    <服务机器人。GcmIntentServiceNAME = />
 

解决方案

看的文档:

  

在android.permission.GET_ACCOUNTS许可作为GCM需要一个谷歌帐户(必要的,只有当如果设备运行的版本低于安卓4.0.4)

此权限不在实例。

I wrote a push notification sample with the help of this doc http://developer.android.com/google/gcm/client.html. It's working on 4.x devices and not working on 2.3.3 devices.

here is my permission :

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

<permission
    android:name="com.example.testing.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

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


   <receiver
        android:name="com.example.testing.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>

            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.example.testing" />
        </intent-filter>
    </receiver>

    <service android:name=".GcmIntentService" />

解决方案

Look to the documentation :

The android.permission.GET_ACCOUNTS permission as GCM requires a Google account (necessary only if if the device is running a version lower than Android 4.0.4)

This permission is not in the examples.

这篇关于在不工作的2.3.3和工作的4.x的设备Pushnotifications的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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