0

I'm trying to integrate Google Cloud Messaging into my application. I have the following code in my onCreate method.

    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);
    if (GCMRegistrar.getRegistrationId(this).equals(""))
        GCMRegistrar.register(this, "xxxxxxxxxxxx");

I have GCMRegistarar imported properly, I have the GCM.jar added to the build paths and my manifest set up. I am installing onto a 2.2 droid 1. Whenever the application launches I get the following crash.

enter image description here

My manifest is as follows

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

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

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8" />

<permission
    android:name="com.my.project.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.my.project.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <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" />

            <category android:name="com.my.project" />
        </intent-filter>
    </receiver>

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

    <activity
        android:name=".Index"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

endy
  • 3,872
  • 5
  • 29
  • 43

1 Answers1

2

I ended up copying the gcm.jar into the libs folder then referencing that gcm.jar to my build paths. It's working now.

endy
  • 3,872
  • 5
  • 29
  • 43