Reputation: 9
I want android to notify me of an app launch by sending a broadcast whenever there is a launch. Where to put the broadcast? I don't want to poll continuously and look for changes in the list of running apps.
Upvotes: 0
Views: 31
Reputation: 6991
Sending a Broadcast
is as easy as few lines of code. Just pass an Intent
object with with sendBroadcast()
method:
Intent intent = new Intent();
intent.setAction("com.example.Broadcast");
intent.putExtra("MyData", 1000);
sendBroadcast(intent);
Upvotes: 2