Android 广播接收机基于意图的动作名称区分呼叫原因

Android 广播接收机基于意图的动作名称区分呼叫原因,android,android-intent,broadcastreceiver,android-pendingintent,intentfilter,Android,Android Intent,Broadcastreceiver,Android Pendingintent,Intentfilter,我的应用程序的广播接收器有问题 我有一种情况,我想广播接收器被调用的3个不同的原因,第一个电话状态改变,第二个,基于定时器,第三个启动完成。然后根据广播接收器被呼叫的原因,我想做一些事情 以下是我的接收者的android清单: <receiver android:name="com.example.mobileraptor.MyPhoneListener" > <intent-filter> <action andro

我的应用程序的广播接收器有问题

我有一种情况,我想广播接收器被调用的3个不同的原因,第一个电话状态改变,第二个,基于定时器,第三个启动完成。然后根据广播接收器被呼叫的原因,我想做一些事情

以下是我的接收者的android清单:

    <receiver android:name="com.example.mobileraptor.MyPhoneListener" >
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <action android:name="com.example.mobileraptor.TimerTriggered" />

        </intent-filter>
    </receiver>
问题是,一旦应用程序想要启动,它就会崩溃。但如果我评论这句话: 操作android:name=“com.example.mobileraptor.TimerTriggered
那么我的申请就可以了


我定义的操作名称有什么问题。

logcat:06-24 19:20:35.319:W/dalvikvm(278):threadid=1:线程退出时出现未捕获异常(group=0x4001d800)06-24 19:20:35.349:E/AndroidRuntime(278):致命异常:main 06-24 19:20:35.349:E/AndroidRuntime(278):java.lang.RuntimeException:无法实例化receiver com.example.mobileraptor.MyPhoneListener:java.lang.ClassCastException:com.example.mobileraptor.MyPhoneListener我修复了该问题。我犯了一个愚蠢的错误,XML文件中的接收方名称与接收方的类名不匹配。
PendingIntent pintent = PendingIntent.getBroadcast( this, 0, new Intent("com.example.mobileraptor.TimerTriggered"), 0 );
    AlarmManager manager = (AlarmManager)(this.getSystemService( Context.ALARM_SERVICE ));

    manager.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), AlarmManager.INTERVAL_HOUR , pintent );