【问题标题】:GOOGLE CLOUD MESSAGE NOT WORKING FOR ANDROID 2.3.6谷歌云消息不适用于 Android 2.3.6
【发布时间】:2013-12-09 12:52:08
【问题描述】:

我无法在 android 2.3.6 版本中通过广播接收器调用onReceive() 方法。(在以后的版本中工作正常)

我的 Android.manifest 文件是

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="hellomultiscreen" android:versionCode="11" android:versionName="2.2.0" >
  <uses-sdk android:minSdkVersion="8" />
  <uses-permission android:name="android.permission.INTERNET" />
  <permission android:name="hellomultiscreen.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <uses-permission android:name="hellomultiscreen.permission.C2D_MESSAGE" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />


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

  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <application android:label="Online Booking" >

    <!-- Only C2DM servers can send messages for the app. If permission is not set - any other app can generate it -->
        <receiver android:name="hellomultiscreen.MyGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
            <!-- Receive the actual message -->
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <action android:name="com.google.android.c2dm.intent.RETRY" />
                <category android:name="hellomultiscreen" />
            </intent-filter>

        </receiver>
    <service android:name="hellomultiscreen.MyIntentService" enabled="true" />
    </application>
    <uses-sdk />
</manifest>

【问题讨论】:

  • 这个有什么错误?
  • onreceive() 通过 gcm 发送消息时未触发但较高版本触发
  • 不要用全部大写字母写任何东西 - 这是一个相当于大喊大叫的网络。
  • 试过但没用...一切都一样

标签: android push-notification cloud message google-cloud-messaging


【解决方案1】:

根据您发布的清单,您的应用程序包名称为hellomultiscreen.cybrainhellomultiscreen。您应该在与 GCM 相关的清单中放置的所有三个包中使用正确的包名称(下面是 YOUR_PACKAGE):

  <permission android:name="YOUR_PACKAGE.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <uses-permission android:name="YOUR_PACKAGE.permission.C2D_MESSAGE" />

<receiver android:name="hellomultiscreen.MyGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
    <!-- Receive the actual message -->
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RETRY" />
        <category android:name="YOUR_PACKAGE" />
    </intent-filter>
</receiver>

【讨论】:

  • 搞错了,其实我只用了hellomultiscreen
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多