开发者

How to create a new Intent for another app's broadcast receiver?

开发者 https://www.devze.com 2023-01-08 19:56 出处:网络
In the examples, they create Intent as: Intent intent = new Intent(this, AlarmReceiver.class); But suppose my AlarmReceiver class is in another app, how do I create this intent?

In the examples, they create Intent as:

Intent intent = new Intent(this, AlarmReceiver.class);

But suppose my AlarmReceiver class is in another app, how do I create this intent?

I've tried with

new Intent("com.app.AlarmReceiver")

but nothing happens.. It was not called..

Any idea?

--Broadcast definition added using the manifest editor on Eclipse:

<receiver android:name="AlarmReceiver"></receiver>
</applicat开发者_运维百科ion>

--

Related:

How do I start my app from my other app? (but this same code is not working for broadcasts..)


But my suppose my AlarmReceiver class is in another app, how do I create this intent?

If you wrote the other app, add an <intent-filter> with a custom action string to the other app's <receiver> element, then use an Intent with that action string.

If you did not write the other app, ask whoever wrote it what the Intent should look like.

0

精彩评论

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

关注公众号