1

アプリケーションでプッシュを有効にしており、マニフェストは次のようになっています。

パッケージ名:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.norton.mobile"
android:versionCode="1"
android:versionName="1.0" >

私の受信機は以下の通りです:

<receiver
        android:name="com.pravaa.mobile.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.stanley.mobile" />
        </intent-filter>
    </receiver>

上記の構成では、OS > 4.1 のデバイスでは通知を正常に受信できますが、OS < 4.1 のデバイスでは通知を受信できません。受信者カテゴリの構成を**<category android:name="com.norton.mobile" />**i に変更すると、OS < 4.1 のデバイスでも通知を正常に受信できました。ドキュメントに「com.google.android.c2dm.intent.RECEIVEのレシーバーで、カテゴリがapplicationPackageとして設定されている」と書かれていることは理解しています。しかし、カテゴリが applicationPackage と一致しませんが、OS > 4.1 のデバイスではどのように機能しますか。誰かがこの背後にある理由を知っていますか? 前もって感謝します。

4

2 に答える 2

1

間違ったカテゴリ名を書いたのかもしれませんが、OS 4.1 以降ではカテゴリ名が必要ないため、うまくいきました。

" カテゴリ タグの android:name をアプリケーションのパッケージ名に置き換える必要があることに注意してください (カテゴリ タグは、minSdkVersion 16 以降を対象とするアプリケーションには必要ありません)。

http://developer.android.com/google/gcm/helper.html#android-app "

于 2014-02-12T10:03:21.870 に答える
0

で構成を確認します

<!-- GCM PERMISSIONS START -->
 <permission
        android:name="com.norton.mobile.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.norton.mobile.permission.MAPS_RECEIVE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <permission
        android:name="com.norton.mobile.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.norton.mobile.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- GCM PERMISSIONS END -->

<!-- GCM RECEIVER And SERVICE START -->

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <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.GCM_RECEIVED_ACTION" />

                <category android:name="com.norton.mobile" />
            </intent-filter>
        </receiver>

        <service
            android:name="com.norton.mobile.GCMIntentService"
            android:enabled="true" />

        <!-- GCM RECEIVER And SERVICE END -->
于 2013-09-13T04:57:23.193 に答える