Michael A
Michael A

Reputation: 5840

Alert dialog display even when the application is not running

I want to notify the user of my app when he receives special news (from my app). How can i display some kind of a messeage to the user, even if my app is running in the background (or not running at all if possible).

I want him to be notified by text, and sound.

Thanks.

Upvotes: 0

Views: 178

Answers (3)

vanleeuwenbram
vanleeuwenbram

Reputation: 1339

If your app is not running and you want to do something you'll need some kind of broadcast receiver to receive a trigger. Probably what you'll end up doing is starting up at device boot, to schedule some stuff. This answer here should get you into the right direction

After that, the best way to notify the user is with notifications (or Toast messages if you're a great fan;)) Have a look at Status Bar Notifications

Upvotes: 1

Kumar Vivek Mitra
Kumar Vivek Mitra

Reputation: 33534

Use Broadcast Receiver, to notify abt some action. Like updates, sms, or abt indicate when booting of a phone completes,etc... BroadCast Receiver works on the principle of Publisher and Subscriber pattern.

Upvotes: 1

Hakan Serce
Hakan Serce

Reputation: 11256

You need to write a service for doing this. Then in your service code use Notification class to show text and sound alerts.

Upvotes: 3

Related Questions