开发者

Android Service make popup in app or outside of app

This may be a compounded question as there are two concepts I don't yet understand that may be related.

I want a Service to popup a custom alert dialog.

I dont know

a) if I can popup an al开发者_Python百科ert dialog from a service (simply haven't tried yet, dont know what context to give it)

and

b) how a service can interact with an activity

and

c) if I can popup an alert dialog from outside the app (it is a niche application, the users will be expecting popup alerts)

Insight appreciated on the best approach to this problem!


I want a Service to popup a custom alert dialog.

This is generally a bad idea.

if I can popup an alert dialog from a service

No, sorry.

how a service can interact with an activity

A service can start an activity, or send a broadcast Intent that is picked up by an activity, or send a Message to a Messenger supplied by an activity, or respond to methods call by a bound activity, or...

it is a niche application, the users will be expecting popup alerts

First, make this configurable. Unless you have precisely one user -- you -- you do not know what your users will want. Having something pop up on the screen and take over the foreground is very intrusive, and only a very few apps will warrant that behavior.

I would make it configurable between a Notification (as Mr. Madsen suggests in the comment) or a dialog-themed Activity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜