开发者

How do I add another intent and how do I call this receiver in code?

I have following receiver that listens to Boot_Completed

<receiver android:name=".receivers.ActionBootCompletedReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <category android:name="android.intent开发者_StackOverflow社区.category.HOME"/>
            </intent-filter>
        </receiver>

I want to add another intent-filter with my own custom action. And make it private to my app if possible. This is mostly for code reuse so I can run same code path as when BOOT_COMPLETED.

So, I need following (if it's even possible) 1. intent-filter and make it private to my app 2. Code to send that intent so my receiver get's it.

Thanks!


Just use another <action> tag! It is all you need to register receiver for an particular intent.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜