开发者

What causes "Unable to start service Intent"?

My app receives an intent from the C2DM servers to register for push notifications (which works fine), and on receiving that message through a broadcast receiver it starts an IntentService (to handle the intent received from C2DM). However the call to start that IntentService is failing with this:

Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION
cat=[com.company.myapp] cmp=com.company.myapp/.receiver.C2DMReceiver
(has extras) }: not found

Can you help me understand what this error means? The C2DMReceiver class is subclassed from IntentService, and it certainly exists. I am using Intent.setClass() and specifying the class directly. The compiler accepts it, so I do not understand why the exception is saying "Not found". What is not found?

If anyone can offer any tips on debugging this, I'd really appreciate it.

    <receiver android:name="com.company.myapp.receiver.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
       开发者_如何学Python <!-- Receive the actual message -->
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.company.myapp" />
        </intent-filter>
        <!-- Receive the registration id -->
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.company.myapp" />
        </intent-filter>
    </receiver>


The cause of this was the tag was missing from the manifest. Unfortunately it looks like I accidentally deleted it from the manifest, probably whilst making another edit. With the manifest entry there, the IntentService starts fine.


Have you registered an Intent filter with action com.google.android.c2dm.intent.REGISTRATION in your AndroidManifest.xml?


You must have a device with android 2.2+ and Market app installed (meaning it's an official Google device).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜