是什么原因导致"无法启动服务意向"? [英] What causes "Unable to start service Intent"?

查看:169
本文介绍了是什么原因导致"无法启动服务意向"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序接收来自C2DM服务器的意图,推送通知登记(其中正常工作),并通过广播接收器接收消息时,它启动一个IntentService(以处理这个意图从C2DM收到)。然而,呼吁启动IntentService与此失败的:

 无法启动服务意向{行动= com.google.android.c2dm.intent.REGISTRATION
猫= [com.company.myapp] CMP = com.company.myapp / .receiver.C2DMReceiver
(有演员)}:未找到

你能帮我明白这是什么错误意味着?该C2DMReceiver类是从IntentService子类,它当然存在。我使用Intent.setClass()和直接指定类。编译器接受它,所以我不明白为什么例外是在说未找到。什么是没有发现?

如果任何人都可以提供调试这任何提示,我真的AP preciate它。

 <接收机器人:名字=com.company.myapp.receiver.C2DMBroadcastReceiver机器人:权限=com.google.android.c2dm.permission.SEND>
        <! - 收到实际的消息 - >
        &所述;意图滤光器>
            <作用机器人:名字=com.google.android.c2dm.intent.RECEIVE/>
            <类机器人:名字=com.company.myapp/>
        &所述; /意图滤光器>
        <! - 收到的注册ID - >
        &所述;意图滤光器>
            <作用机器人:名字=com.google.android.c2dm.intent.REGISTRATION/>
            <类机器人:名字=com.company.myapp/>
        &所述; /意图滤光器>
    < /接收器>


解决方案

这样做的原因是标签从清单中失踪。不幸的是,它看起来像我意外地从清单中删除的,而可能使另一个编辑。随着清单项那里,IntentService启动正常。

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">
        <!-- 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.

这篇关于是什么原因导致&QUOT;无法启动服务意向&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆