0

コード GCMRegistrar.checkManifest (this); を使用します。私のアプリケーション (Android) 次のエラーが発生します: パッケージ com.saluteonline のレシーバーがありません

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.saluteonline"
android:versionCode="1"
android:versionName="1.0" >

<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
    android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity_test"></activity>
    <activity android:name=".RegistrationActivity"></activity>
    <activity android:name=".retriveMessage"></activity>
    <activity android:name=".CustomizedListView"></activity>
    <activity android:name=".viewMessage"></activity>


   <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        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.androidhive.pushnotifications" />
        </intent-filter>
    </receiver>

    <service android:name=".GCMIntentService" />
</application>

</manifest>

エミュレーターと電話の両方で同様のエラーが表示されます

4

1 に答える 1

0

com.androidhive.pushnotifications を使用している場所では、独自のアプリ パッケージ名 com.salutonline を使用する必要があります。詳細については、開発者 android で android gcm のデモ例を確認してください。サンプル マニフェストには、すべてを非常によく説明するコメントがあります。

Demo Activity Android Developer Docs からこのマニフェストを確認してください。

<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<!-- The targetSdkVersion is optional, but it's always a good practice
     to target higher versions. -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!--
 Creates a custom permission so only this app can receive its messages.

 NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
       where PACKAGE is the application's package name.
-->
<permission
    android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />
<uses-permission
    android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive data message. -->
<uses-permission
    android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- Main activity. -->
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".DemoActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!--
      BroadcastReceiver that will receive intents from GCM
      services and handle them to the custom IntentService.

      The com.google.android.c2dm.permission.SEND permission is necessary
      so only GCM services can send data messages for the app.
    -->
    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        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.google.android.gcm.demo.app" />
        </intent-filter>
    </receiver>

    <!--
      Application-specific subclass of GCMBaseIntentService that will
      handle received messages.

      By default, it must be named .GCMIntentService, unless the
      application uses a custom BroadcastReceiver that redefines its name.
    -->
    <service android:name=".GCMIntentService" />
</application>

于 2013-07-10T18:20:50.330 に答える