Android c2dm消息未收到

发布于 2024-12-13 08:35:08 字数 2797 浏览 0 评论 0原文

当我尝试在设备中接收消息时,我遇到了问题,一切正常,但是当我尝试接收消息时什么也没有发生,我得到:

id=0:1319039498507602%b50b7d2400000031

来自 https://android.apis.google.com/c2dm/send

这意味着消息已发送,不是吗?

但我无法在设备中接收它。 清单:-

> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
>       package="com.cgt.pushn"
>       android:versionCode="1"
>       android:versionName="1.0">
>        <permission android:name="com.cgt.pushn.permission.C2D_MESSAGE" android:protectionLevel="signature" />    <uses-permission
> android:name="com.cgt.pushn.permission.C2D_MESSAGE" />
> 
>    <!-- This app has permission to register and receive message -->   
> <uses-permission
> android:name="com.google.android.c2dm.permission.RECEIVE" />
> 
>    <!-- Send the registration id to the server -->    <uses-permission
> android:name="android.permission.INTERNET" />
>       <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
> <uses-permission android:name="android.permission.USE_CREDENTIALS" />
> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
> 
>     <application android:icon="@drawable/icon" android:label="@string/app_name" >
>     <activity android:name=".pushtest"
>                   android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER"/>
>             </intent-filter>
>         </activity> <!--        android:name="com.google.android.c2dm.C2DMBroadcastReceiver" -->
> 
>    <receiver android:name=".BroadcastReciever"
> android:permission="com.google.android.c2dm.permission.SEND"> <!--    
> -->
>           <intent-filter>
>               <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
>               <category android:name="com.cgt.pushn" />
>           </intent-filter>
>           <!-- Receive the registration id -->
>           <intent-filter>
>               <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
>               <category android:name="com.cgt.pushn"/>
>           </intent-filter>
>       </receiver>
>     </application>
>     <uses-sdk android:minSdkVersion="8" />
> 
> </manifest>

有人可以帮助我吗?

I'm facing a problem when I try to receive message in my device, everything works fine but when I try to receive it nothing come, I'm getting:

id=0:1319039498507602%b50b7d2400000031

from https://android.apis.google.com/c2dm/send

it mean that message sent, isn't?

but i can't receive it in device.
MANIFEST:-

> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
>       package="com.cgt.pushn"
>       android:versionCode="1"
>       android:versionName="1.0">
>        <permission android:name="com.cgt.pushn.permission.C2D_MESSAGE" android:protectionLevel="signature" />    <uses-permission
> android:name="com.cgt.pushn.permission.C2D_MESSAGE" />
> 
>    <!-- This app has permission to register and receive message -->   
> <uses-permission
> android:name="com.google.android.c2dm.permission.RECEIVE" />
> 
>    <!-- Send the registration id to the server -->    <uses-permission
> android:name="android.permission.INTERNET" />
>       <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
> <uses-permission android:name="android.permission.USE_CREDENTIALS" />
> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
> 
>     <application android:icon="@drawable/icon" android:label="@string/app_name" >
>     <activity android:name=".pushtest"
>                   android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER"/>
>             </intent-filter>
>         </activity> <!--        android:name="com.google.android.c2dm.C2DMBroadcastReceiver" -->
> 
>    <receiver android:name=".BroadcastReciever"
> android:permission="com.google.android.c2dm.permission.SEND"> <!--    
> -->
>           <intent-filter>
>               <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
>               <category android:name="com.cgt.pushn" />
>           </intent-filter>
>           <!-- Receive the registration id -->
>           <intent-filter>
>               <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
>               <category android:name="com.cgt.pushn"/>
>           </intent-filter>
>       </receiver>
>     </application>
>     <uses-sdk android:minSdkVersion="8" />
> 
> </manifest>

someone could help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿童谣 2024-12-20 08:35:08

您忘记写服务标签。在您的接收者标签上方输入以下标签。

    <!-- In order to use the c2dm library, an
     application must declare a class with the name C2DMReceiver, in its 
     own package, extending com.google.android.c2dm.C2DMBaseReceiver -->

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

请参阅下面的链接

      http://www.johnhawthorn.com/2010/12/android-cloud-to-device-messaging-1/

you forgot to write service tag. Enter below tag above your receiver tag.

    <!-- In order to use the c2dm library, an
     application must declare a class with the name C2DMReceiver, in its 
     own package, extending com.google.android.c2dm.C2DMBaseReceiver -->

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

see below link

      http://www.johnhawthorn.com/2010/12/android-cloud-to-device-messaging-1/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文